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.
精彩评论