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_parts
1 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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.