开发者

Getting the host and URI in PHP when request is passed via a proxy

We have a site that resides on server A with the URL eg www.blah.com, however when it is live it will be accessed at the url eg www.notblah.com which will proxy the request to server A.

My question is, in PHP how does one properly work out the host and URI when the request is passed via a proxy? $_SERVER['host'] and $_SERVER['uri'] give me www.blah.com not the URL accessed v开发者_如何学Cia the proxy server.


Try $_SERVER['HTTP_REFERER'] or check with phpinfo() if your proxy adds the original URL into the HTTP headers. Some do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜