[Zope] Odd Redirect Behaviour
Oliver Bleutgen
Oliver Bleutgen <myzope@gmx.net>
Tue, 12 Jun 2001 22:32:12 +0200
> Hi,
> I'm running Zope on the same machine as Apache+PHP. I'm not trying to do
> anything clever - all I want to do is to redirect requests to
> http://www.spiderplant.net/dan/redirect.php (that was index.html but I'v=
e
> renamed it just for the mo) to
> http://www.spiderplant.net:8080/anticlimax/.
> To do this, I'm using the following code in redirect.php:
> <?php header("Location:
> http://www.spiderplant.net:8080/anticlimax/index_html") ; ?>
> Now, when I visit www.spiderplant.net/dan/redirect.php, the browser
> correctly redirects. However, none of the URLs generated in the index_ht=
ml
> method have the port number in them; for example, this occurs:
> <img src=3D"http://www.spiderplant.net/anticlimax/titleImage"
> alt=3D"Anticlimax
> Front Page Image" height=3D"80" width=3D"600" border=3D"0" />
> Notice the 8080 is missing from the hostname.
> Why is this occurring? What's so special about doing a redirect *to* Zop=
e
> that breaks it?
> Feel free to visit the URLs above and see what I mean.
> Yours confusedly,
> Dan
Just tested it with the excellent tcpwatch from Shane
Hathaway.
The problem lies not in zope, it's the browser=20
(I use IE 5.00.dontaskme).
First it goes to http://www.spiderplant.net/dan/redirect.php:
=3D=3D> GET http://www.spiderplant.net/dan/redirect.php HTTP/1.0
=3D=3D> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
=3D=3D> Accept-Language: de
=3D=3D> Accept-Encoding: gzip, deflate
=3D=3D> User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; QXW033=
36)
=3D=3D> Host: www.spiderplant.net
=3D=3D> Proxy-Connection: Keep-Alive
=3D=3D>=20
[0.070 - Server connected]
<=3D=3D HTTP/1.1 302 Found
<=3D=3D Server: Apache/1.3.12 (Unix) PHP/4.0.4 mod_perl/1.24 mod_ssl/2.6.4=
OpenSSL/0.9.5a
<=3D=3D X-Powered-By: PHP/4.0.4
<=3D=3D Content-Type: text/html
<=3D=3D Date: Tue, 12 Jun 2001 20:36:40 GMT
<=3D=3D Location: http://www.spiderplant.net:8080/anticlimax/index_html
<=3D=3D Proxy-Connection: Keep-Alive
<=3D=3D=20
<=3D=3D owser bug
<=3D=3D=20
[0.210000 - Closed by Client]
(Does anybody now what "owser bug" above should mean?
Is this a sign?)
You see it gets the redirect (302) and this happens:
=3D=3D> GET http://www.spiderplant.net:8080/anticlimax/index_html HTTP/1.0
=3D=3D> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
=3D=3D> Accept-Language: de
=3D=3D> Accept-Encoding: gzip, deflate
=3D=3D> User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; QXW033=
36)
=3D=3D> Host: www.spiderplant.net
=3D=3D> Proxy-Connection: Keep-Alive
=3D=3D>=20
[0.040 - Server connected]
<=3D=3D HTTP/1.0 200 OK
<=3D=3D Server: Zope/Zope 2.3.2 (binary release, python 1.5.2, linux2-x86)=
ZServer/1.1b1
<=3D=3D Content-Type: text/html
<=3D=3D Date: Tue, 12 Jun 2001 20:36:40 GMT
<=3D=3D Content-Length: 1261
<=3D=3D Proxy-Connection: Keep-Alive
<=3D=3D=20
<=3D=3D <html>
<=3D=3D <head>
<=3D=3D <!-- Don't complain the code is messy, auto generated code usu=
ally is. -->
<=3D=3D <title>Anticlimax</title>
<=3D=3D =09<link rel=3D"stylesheet" type=3D"text/css" href=3D"http://www.s=
piderplant.net/anticlimax/stylesheet">
<=3D=3D=20=20=20=20=20
<=3D=3D =09=09=09<script language=3D"JavaScript" src=3D"http://www.spiderp=
lant.net/anticlimax/main/JavaScript/NewWindow.js"></script>
<=3D=3D=20
[snip]
=3D=3D> GET http://www.spiderplant.net/anticlimax/main/JavaScript/NewWindo=
w.js HTTP/1.0
=3D=3D> Accept: */*
=3D=3D> Referer: http://www.spiderplant.net:8080/anticlimax/index_html
=3D=3D> Accept-Language: de
=3D=3D> Accept-Encoding: gzip, deflate
=3D=3D> User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; QXW033=
36)
=3D=3D> Host: www.spiderplant.net
=3D=3D> Proxy-Connection: Keep-Alive
=3D=3D>=20
<=3D=3D </body></html>HTTP/1.1 404 Not Found
<=3D=3D Date: Tue, 12 Jun 2001 20:34:29 GMT
<=3D=3D Server: Apache/1.3.12 (Unix) PHP/4.0.4 mod_perl/1.24 mod_ssl/2.6.4=
OpenSSL/0.9.5a
<=3D=3D Connection: close
<=3D=3D Content-Type: text/html; charset=3Diso-8859-1
<=3D=3D=20
<=3D=3D <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<=3D=3D <HTML><HEAD>
<=3D=3D <TITLE>404 Not Found</TITLE>
<=3D=3D </HEAD><BODY>
<=3D=3D <H1>Not Found</H1>
<=3D=3D The requested URL /anticlimax/main/JavaScript/NewWindow.js was not=
found on this server.<P>
<=3D=3D <HR>
<=3D=3D <ADDRESS>Apache/1.3.12 Server at www.spiderplant.net Port 80</ADDR=
ESS>
<=3D=3D </BODY></HTML>
If you look at the Host: header, you see www.spiderplanet.net.
If I go directly to that URI, I get=20
=3D=3D> GET http://www.spiderplant.net:8080/anticlimax/index_html HTTP/1.0
=3D=3D> Accept: */*
=3D=3D> Accept-Language: de
=3D=3D> Accept-Encoding: gzip, deflate
=3D=3D> User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; QXW033=
36)
=3D=3D> Host: www.spiderplant.net:8080
=3D=3D> Proxy-Connection: Keep-Alive
=3D=3D>=20
[0.140 - Server connected]
<=3D=3D HTTP/1.0 200 OK
<=3D=3D Server: Zope/Zope 2.3.2 (binary release, python 1.5.2, linux2-x86)=
ZServer/1.1b1
<=3D=3D Content-Type: text/html
<=3D=3D Date: Tue, 12 Jun 2001 20:38:18 GMT
<=3D=3D Content-Length: 1286
<=3D=3D Proxy-Connection: Keep-Alive
[snip]
Now the Host: header contains the correct portnumber.
As I see it, zope does the right thing...
Perhaps you should use proxying instead of a redirect.
cheers,
oliver