Community
Participate
Working Groups
Build Identifier: 7.4.5-7.5.1 For example, with RedirectListener enabled: request 1 to: http://foo.com/index GET /index Host: foo.com response with redirect: HTTP 1.1 OK 301 Location: http://bar.com/foo request 2 to: http://bar.com/foo (via RedirectListener): GET /foo Host: foo.com This is wrong. The following Host should be sent on the 2nd request: Host: bar.com This causes a good number of sites to fail with 404 Not Found (i.e. virtual host configs) or 30x (another redirect with the same Location). I was able to fix this by adding the following to RedirectListener.checkExchangeComplete, in the destination not equal condition branch: // Fixup the Host header Address adr = _exchange.getAddress(); int port = adr.getPort(); StringBuilder hh = new StringBuilder( 64 ); hh.append( adr.getHost() ); if( !( ( port == 80 && !isHttps ) || ( port == 443 && isHttps ) ) ) { hh.append( ':' ); hh.append( port ); } _exchange.setRequestHeader( HttpHeaders.HOST, hh.toString() ); This is copied from Reproducible: Always
Created attachment 204140 [details] patch
This is a mirror of https://jira.codehaus.org/browse/JETTY-1420
applied, thanks for going through the hassle