http://www.perlmonks.org?node_id=869516

punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:

Mordant Monks,

Scratching my head over this. This snippet is in a script accessed over the web:

print "<p>base_url = $base_url\n"; $base_url = 'http://123.456.789.000'; print "<p>base_url = $base_url\n";
which usually correctly produces
base_url = base_url = http://123.456.789.000
But one user is accessing my script through a proxy server. (EZProxy, what else?) When they access it, they get:
base_url = base_url = http://proxy.theirdomain.com:xxxx
The variable $base_url is hard-coded in the script. The fact of coming from a proxy server should have zero effect on that. Now, this script uses only one module, CGI.

Am I unwittingly referencing a special variable or something that's overridding my hard-coded value?

Thanks

UPDATE

Immediately following the above snippet, there comes:

print "<p>at A called_from = $called_from\n"; print "<p>at A base_url = $base_url\n"; @url_parts = split (/$base_url.*?\// ,$called_from); print "<p>at B base_url = $base_url\n"; for $i (0 .. $#url_parts) { print "<br>url_parts[$i] = $url_parts[$i]\n"; }
where "called_from" is the url of the referring page that called the script, set earlier in the script. Again, when I access it, it correctly outputs:
at A called_from = http://123.456.789.000/mysubfolder/mypage.htm at A base_url = http://123.456.789.000 at B base_url = http://123.456.789.000 url_parts[0] = url_parts[1] = mysubfolder/mypage.htm
but when my proxied friend tries it, they get
at A called_from = http://proxy.theirdomain.com:xxxx/mysubfolder/mypag +e.htm at A base_url = http://proxy.theirdomain.com:xxxx at B base_url = http://proxy.theirdomain.com:xxxx url_parts[0] = url_parts[1] =
So, OK, I don't get why it's substituting their proxy domain for the hard-coded $base_url - but considering the value of $called_from, url_parts1 should have been the same mysubfolder/mypage.htm as I get - no? Makes me think there's really something weird going on with this $base_url variable.




Time flies like an arrow. Fruit flies like a banana.