On Mon, Oct 4, 2010 at 7:44 PM, Paul Davis <[email protected]> wrote: > On Mon, Oct 4, 2010 at 12:26 PM, Benoit Chesneau <[email protected]> wrote: >> On Mon, Oct 4, 2010 at 5:49 PM, Paul Davis <[email protected]> >> wrote: >> >>> I'm not entirely sure about rewriting headers. For the most part I >>> wanted to make sure that I wasn't modifying headers in anyway. If >>> there's a specific set of headers that need to be handled then we can >>> take a look at adding that in. >>> >> At least Location need cleaning at least since you get full headers >> and pass them to mochiweb directly in start_response. A remote server >> can set a Location to /some/path but you display behind >> /_proxied/some/path. Also during redirection (302/303) , rewriting >> locaton may be needed too though redirecting isn't handled yet. >> >> I've already some code for that from couchdbproxy. Will provide a patch. >> - benoit >> > > Actually I need to update the patch. I was reading RFC 2616 the other > day and they specifically state that a proxy is not allowed to rewrite > URL paths. > > I'm also not sure about the Location headers. I'll have to go back and > look to see what people are doing in terms of if they're setting > absolute or relative URI's. Theoretically, if they're relative then it > should work just fine. > > Paul >
You can have a look on these code : http://github.com/apache/httpd/blob/trunk/modules/proxy/mod_proxy_http.c#L1196 http://github.com/mojombo/yaws/blob/master/src/yaws_revproxy.erl#L399 They are rewriting Location header if needed. - benoit
