Strange behaviour of web directory requests without a trailing slash
Archive - Originally posted on "The Horse's Mouth" - 2008-03-06 16:25:13 - Graham Ellis
When you call up a web page and you give a directory name WITHOUT a training slash, the web server return a "moved temporarily" page - code 302 - giving you the same name WITH a trailing slash as your new page:
Dorothy:~ grahamellis$ telnet 192.168.200.162 80
Trying 192.168.200.162...
Connected to 192.168.200.162.
Escape character is '^]'.
GET /jdemo HTTP/1.0
HTTP/1.1 302 Moved Temporarily
Date: Thu, 06 Mar 2008 14:20:08 GMT
Server: Apache-Coyote/1.1
Location: http://192.168.200.162/jdemo/
Content-Length: 0
Connection: close
Content-Type: text/plain
and that's followed by
Dorothy:~ grahamellis$ telnet 192.168.200.162 80
Trying 192.168.200.162...
Connected to 192.168.200.162.
Escape character is '^]'.
GET /jdemo/ HTTP/1.0
HTTP/1.1 200 OK
Date: Thu, 06 Mar 2008 14:20:55 GMT
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=51F67B6EBA96D532A6E405BAD2129968; Path=/latmjdemo
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1070
Connection: close
This extra loop means that you'll get very odd behavior if you call for a page without a trailing slash on a server on which either
a) You don't have the server name properly set up or
b) You are proxying, and your ProxyPassReverse isn't compatibly configured.