/ Zope / Apsis / Pound Mailing List / Archive / 2005 / 2005-05 / Windows' IIS Redirect issue

[ << ] [ >> ]

[ List of new pound-1.8.3 issues introduced since ... ] [ pound config error / "Guy Speier" ... ]

Windows' IIS Redirect issue
Darek Milewski <darek(at)nyi.net>
2005-05-04 18:09:04 [ FULL ]
Hello, I have a fairly simple setup.  A single domain redirected to 2 
internal servers.  Config:

ListenHTTP x.x.x.x,80
ListenHTTPS x.x.x.x,443 /path/to/cert.pem
HeadRemove "X-SSL-Request"
HTTPSHeaders 0 "X-SSL-Request: 1"

LogLevel 2

UrlGroup ".*"
HeadRequire Host ".*host.com.*"
BackEnd 10.10.10.2,80,1
BackEnd 10.10.10.3,80,1
Session IP 1800
EndGroup

The backend servers are Windows.  Running IIS.  The client has 
configured redirection under "host.com properties" -> Home Directory tab 
-> "Content ... should come from ... A redirection to a URL" with 
"http://www.host.com/" specified.  They
claim they set it up the same 
way as on another machine, where it works witout problems.

Pulling up http://www.host.com works fine.

Pulling up http://host.com causes the browser to
stop due to a redirect 
loop.

I ran a packet sniffer and found this

from the client:

GET / HTTP/1.1\r\n
Request Method: GET
Request URI: /
...
Host: host.com\r\n
User-Agent:
...
Connection: keep-alive\r\n
\r\n

and the response from the server

HTTP/1.1 302 Redirect\r\n
Request Version: HTTP/1.1
Response Code: 302
Content-Type: text/html\r\n
Location: http://host.com/\r\n
Server: Microsoft-IIS/6.0\r\n
...
\r\n
Line-based text data: text/html
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a 
HREF="http://www.host.com/">here</a></body>

The same request/response exchange then repeats a few times.

I see that the server sends back the Location header to only say 
host.com, not www.host.com.  The responses go back through to 
loadbalancer, out to the client.  Is the Location header modified by 
Pound in any way, or is it coming from IIS?

Lastly, does the HREF in the HTML sent back have any effect on automatic 
redirect on the client side?  I believe it is the Location header that 
the browser looks at.

Sorry for the long message, but this is probably a simple issue, and I 
wanted to give all the relevant details.  Though I couldn't find any 
relevant info in the list archives.  Thank you for any info or pointers.

Re: Windows' IIS Redirect issue
Darek Milewski <darek(at)nyi.net>
2005-05-11 20:08:33 [ FULL ]
I did some additional dumps.  It appears that pound is either changing 
the Location header sent back to the client, or setting the value for 
the Location header to some default value.  Maybe the value of the Host 
header.

This is the request from a client:

Hypertext Transfer Protocol
    GET / HTTP/1.1\r\n
        Request Method: GET
        Request URI: /
        Request Version: HTTP/1.1
    Host: website.com\r\n
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.7.5) Gecko/20041107 Firefox/1.0\r\n
    Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
    Accept-Language: en-us,en;q=0.5\r\n
    Accept-Encoding: gzip,deflate\r\n
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
    Keep-Alive: 300\r\n
    Connection: keep-alive\r\n
    \r\n

This is the request as it is forwarded via the private network to the 
backend (from 10.10.10.1 to 10.10.10.2):

Hypertext Transfer Protocol
    GET / HTTP/1.1\r\n
        Request Method: GET
        Request URI: /
        Request Version: HTTP/1.1
    Host: website.com:80\r\n
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
rv:1.7.5) Gecko/20041107 Firefox/1.0\r\n
    Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
    Accept-Language: en-us,en;q=0.5\r\n
    Accept-Encoding: gzip,deflate\r\n
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
    Keep-Alive: 300\r\n
    Connection: keep-alive\r\n
    X-Forwarded-For: 4.2.2.1\r\n
    \r\n

This is the response sent from the backend to pound (from 10.10.10.2 to 
10.10.10.1):

Hypertext Transfer Protocol
    HTTP/1.1 302 Redirect\r\n
        Request Version: HTTP/1.1
        Response Code: 302
    Content-Length: 156\r\n
    Content-Type: text/html\r\n
    Location: http://www.website.com//\r\n
    Server: Microsoft-IIS/6.0\r\n
    X-Powered-By: ASP.NET\r\n
    Date: Wed, 11 May 2005 17:11:35 GMT\r\n
    \r\n
Line-based text data: text/html
    <head><title>Document Moved</title></head>
    <body><h1>Object Moved</h1>This document may be found
<a 
HREF="http://www.website.com//">here</a></body>


This is the response forwarded from pound to the client:

Hypertext Transfer Protocol
    HTTP/1.1 302 Redirect\r\n
        Request Version: HTTP/1.1
        Response Code: 302
    Content-Length: 156\r\n
    Content-Type: text/html\r\n
    Location: http://website.com//\r\n
    Server: Microsoft-IIS/6.0\r\n
    X-Powered-By: ASP.NET\r\n
    Date: Wed, 11 May 2005 17:11:35 GMT\r\n
    \r\n
Line-based text data: text/html
    <head><title>Document Moved</title></head>
    <body><h1>Object Moved</h1>This document may be found
<a 
HREF="http://www.website.com//">here</a></body>

If you look at the last 2 packets, the Location header is obviously 
changed by pound from what it gets from the backend, to what it sends 
back to the client.

The backend sets the Location header to www.website.com.  Pound forwards 
the request back to the client but it changes Location to just 
website.com, causing a redirect loop.

Is anyone at all familiar with the code that I'd need to change to fix 
this, or would have other suggestions?

Thanks for any input.
- Darek

Re: Windows' IIS Redirect issue
"Timo Hummel" <timo.hummel(at)4fb.de>
2005-05-12 06:39:59 [ FULL ]
Hi,
[...]

probably set the option 

RewriteRedirect 0

in your config file.

cheers,
 Timo

MailBoxer