(bug 47807) Strip proxy URLs for mobile requests

Varnish frontends for mobile currently rewrite Host headers for requests
to e.g. en.m.wikipedia.org to en.wikipedia.org while setting
X-Subdomain: M at the same time. Therefore, MediaWiki has no knowledge
of a wiki config for en.m.wikipedia.org.

It turns out that some requests come as proxy URLs, presumably due to
(transparent) forward proxies. The proxy URL does not get rewritten and
Apaches get requests for:
  GET http://en.m.wikipedia.org/wiki/Foo
  Host: en.wikipedia.org
  X-Subdomain: M
The proxy URL takes precedence over Host, and this results in a "Missing
wiki" redirect coming from MediaWiki.

Fix this by always stripping proxy URLs right next to where we do the
rewrites.

Change-Id: I3d02804170f7e502300329740cba9f45437a24fa