Geolocation Testing at Vivid Seats

Kirat Bajwa
Vivid Seats Tech Blog
4 min readMay 10, 2021

Here at Vivid Seats, we have different applications, web based, mobile applications (iOS and android), iframe solutions and white label products and we filter results based on user’s location on the home page. For testing these applications, we follow both manual and automated approaches. As with many e-commerce sites, there are requirements to render different versions of the website to customers in different geolocations due to targeting marketing or due to local regulations.

Testing Scenario: To test the functionality on home page to show user’s current location as well as upcoming events based on that location. How do we test it?

Manual Geolocation Testing in Testing Environment

In the local testing environment, where we do not route our local traffic to our content delivery network (CDN) and our internet security services, it is possible to use a simple proxy server or a chrome plugin to modify the X-Forwarded-For header.

The X-Forwarded-For HTTP header is a common method of identifying the originating IP address of a particular request. As such, by modifying this header we could trick the server in believing we are in a different geolocation or in our case we changed our location to be in Montreal, Quebec.In the following example we are using the ModHeader Chrome extension to perform our test.

As you can see in the above screen shot, we have modified our IP address to a location in Montreal and we managed to trick our website in believing the end client is in Montreal and we show upcoming events in Montreal. Apart from using the ModHeader chrome extension, it is also possible to route traffic through an internal proxy server i.e., Charles proxy or Squid proxy. The proxy server could append the X-Forwarded-For header to all traffic routing through the proxy.

Manual Geolocation Testing in Production

Unfortunately (or should I say fortunately) the X-Forwarded-For IP spoofing method doesn’t work in our production site due to our internet security features. Thus, we are required to use an external proxy server to perform a similar test in production. In Vivid Seats, we use Nord VPN as a tool to “modify our IP address” by routing our traffic through a VPN in Montreal. As a result, my machine acts as if I am a user based in Montreal, trying to access Vivid Seats. Using Nord VPN, I can test applications across different browsers and choose any location around the world to test the application.

Automated Geolocation Testing Using Selenium

The next step is to automate our geolocation testing using UI Automation Framework like Selenium. Similar to our manual testing in the testing environment approach, we will be modifying our HTTP headers to spoof our IP address. We decided to use Browsermob proxy, an open-source tool, to manipulate the network traffic, so we are able to spoof our IP address to one in Montreal.

In Java, we are able to create an instance of the proxy in code and instruct Selenium to route all client-side traffic through the proxy server as per the diagram below.

With the traffic redirected through Browsermob proxy, we are able to modify the X-Forwarded-For header in code while running our automation.

Using the above setup and HTTP overrides, it will appear as if a user is based in Montreal and when a user tries to access Vivid Seats testing environment and user navigates to the home page, there the user will see suggestions for upcoming sports, music and concert events in and near Montreal.

Conclusion

Robust manual and automated geolocation testing are not only possible but also a necessity for any e-commerce website.

Compiled by Chien Tan and Kirat Bajwa

--

--