LoadBalancer Redirect Bug [WAS: Re: [Yanel-dev] OpenID integration working now]

Michael Wechner michael.wechner at wyona.com
Sun Jan 27 22:08:53 CET 2008


Michael Wechner wrote:

> Michael Wechner wrote:
>
>>
>> It seems that Yanel does everything correctly
>>
>> T 127.0.0.1:9190 -> 127.0.0.1:33248 [AP]
>>  HTTP/1.1 301 Moved Permanently..Location: 
>> http://www.ezra.com:80/test.html..Content-Length: 0..Date: S
>>  un, 27 Jan 2008 14:56:54 GMT..Server: Apache-Coyote/1.1....
>>
>> but the load balancer for whatever strange reason is rewriting the 
>> redirect:
>>
>> T 127.0.0.1:9090 -> 127.0.0.1:47680 [AP]
>>  HTTP/1.1 301 Moved Permanently..Location: 
>> http://127.0.0.1:9090/test.html..Content-Length: 0..Date:
>>   Sun, 27 Jan 2008 14:56:54 GMT..Server: Apache-Coyote/1.1....
>
>
>
>
> It seems that the load balancer is really rewriting redirects:
>
> (src/java/com/wyona/tomcat/cluster/proxy/HttpProxy.java)
>
>    private void rewriteResponseHeaders(HttpServletResponse 
> servletResponse, HttpMethod method, RequestStatus status) {
>        switch (status.getStatusCode()) {
>            case HttpStatus.SC_MOVED_PERMANENTLY:
>            case HttpStatus.SC_MOVED_TEMPORARILY:
>                rewriteLocation(servletResponse, method);
>            break;
>        }
>    }
>
>
> but it's strange, because it should only rewrite 302 reponses and not 
> 301 ...
>
> Also I don't understand why it actually rewrites just one of them ...
>
> Will debug some more ;-)


I think I have fixed it now, but I am not sure if this is according to 
the spec of redirects behind a load balancer (or reverse proxy) or if 
there is actually a spec for this. Will need to ask Gregor Imboden who 
developed most of the code initially.


Cheers

Michi

>
> Cheers
>
> Michi
>
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner at wyona.com, michi at apache.org
+41 44 272 91 61



More information about the Yanel-development mailing list