Page MenuHomePhabricator

Investigate how to fake HTTP headers
Closed, ResolvedPublic


Zero team uses a HTTP header to fake IPs. Until they implement a different way of faking IPs, investigate if Selenium can fake HTTP headers.

Version: unspecified
Severity: normal
Whiteboard: gci2013



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:18 AM
bzimport set Reference to bz48218.

Do we know if Zero team still needs this? Who do we ping there to find out?

To make it explicit, the solution should use Selenium Ruby bindings:

We (zero) are currently forced to do testing via our own testing framework (simple script), which is obviously far "superior" to what Selenium offers. We would really like to switch to selenium for testing, but unless we can SET headers on request (we don't care about reading headers in the response), we can't use selenium.

I am aware of the proxying solution, but that is not very applicable - we need to set header = value1, test that results match value1, set it to value2, etc.

I have changed the title, since it looks to me that this should not be done with Selenium, but another tool.

If you need more information (and you probably do), feel free to ask questions
here, at #wikimedia-qa freenode IRC channel or at QA mailing list:

The goal of this task is to find out what zero team needs and to implement at least one simple test, proving that the solution you found works.

Yuri, can you provide more detail?

Mayank (Google Code-in student) is working on this. He needs an example that he will implement.

We currently built a workaround in production, allowing header values to also be passed as URL params. This is obviously a hack, but has worked more or less ok, as long as we don't test what happens after the click (URL params are not preserved via links)

Here is an example, but this URL ONLY works if you don't have forceHTTPS or other cookies set - use privacy browser when testing:

That same X-CS could be passed as a header, making testing check if the site shows proper behavior after clicking.

If some other carrier was used, for example X-CS=250-99 -- -- they only whitelist en & ru, which means navigating to other languages should not show the banner.

Let me know if you have any questions!

Change 101485 had a related patch set uploaded by Mayankmadan:
Adding a test to check if supplying custom headers works

  • Bug 61379 has been marked as a duplicate of this bug. ***

Change 106709 had a related patch set uploaded by Zfilipin:
Adding Cucumber tests First cucumber test for checking the banners on Wikipedia Zero.

Change 101485 abandoned by Zfilipin:
WIP: Adding a test to check if supplying custom headers works

Moved to

This is now implemented in

Please take a look and merge into ZeroRatedMobileAccess.

Change 114153 had a related patch set uploaded by Zfilipin:
Added links for ZeroRatedMobileAccess repository

Change 106709 merged by jenkins-bot:
The first Selenium test: banners

Change 114153 merged by jenkins-bot:
Added links for ZeroRatedMobileAccess repository