Reputation: 21
I've googled and googled and am stumped.
I am trying to capture the url of a page after logging into the proxy
url of page before proxy login:
https://example.org/mypage.php
url of page after proxy login:
https ://example-org.proxy.example.org/mypage.php
When I try to capture the url using
$lnk = "https ://$_SERVER['HTTP_HOST']$_SERVER['REQUEST_URI']";
the output is as desired:
https ://example-org.proxy.example.org/mypage.php
When I leave off the https:// and just capture the $SERVER variables the output lacks the proxy part of the url.
$lnk = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
output:
example.org/mypage.php
The latter makes sense as if I dump the $SERVER array I see that the the proxy part of the url missing. How is it finding the proxy info in the first example?
Update:
I've used an incogneto window in Chrome and tried it on IE, same behavior.
I tried the following
$lnk = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$lnk2 = "https://".$lnk;
echoing out both variables give the same results as above. If I change the http:// to 'bla' or 'bla://' $lnk and $lnk2 both show the expected non proxied url. It appears that http:// and https:// are changing this somehow and for the life of me I can't figure out how.
Upvotes: 1
Views: 97
Reputation: 21
Turns out the proxy was likely doing a search and replace on the stream. I added a couple of lines of code to print the contents of $lnk2 to a file right after creation and sure enough it lacked the proxied url as expected. Glad to know I wasn't going crazy.
Upvotes: 1