From: David O. <da...@qc...> - 2015-06-26 10:15:36
|
Hi, We've been looking at using Naviserver as a reverse proxy so it can serve up fastpath requests, and also forward requests to an upstream app server when required. There was a couple of issues we came across that I'd like to ask about. The proxy server code follows the same basic idea as Gustaf's post here: http://sourceforge.net/p/naviserver/mailman/message/31063859/ 1. Host header fields. When we forward a request upstream using ns_ssl I couldn't find a way of getting the Host header field to be forwarded untouched by ns_ssl. I pass the query headers into ns_ssl which include a Host field containing the host originally request by the client, and ns_ssl always overwrites it with the value of the upstream Host. I don't think this behaviour is wrong by any means, but, in Apache for example, there is an option which turns on the behaviour we were looking for - proxyPreserveHost http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost Could there be scope for such an argument for ns_ssl (and ns_http as well I guess) or is there a better way to deal with this? Something like this: https://bitbucket.org/davidqc/nsssl/branches/compare/davidqc/nsssl:tip%0Dnaviserver/nsssl:default#diff 2. Duplicate headers added by ns_respond. Once upstream has replied to the proxy, the response is passed back to the client using ns_respond with the headers we received from upstream. What we are seeing is duplicate content-type and content-length headers being received by the client. It seems like this may be because Ns_ConnUpdateHeaders is using a case sensitive Ns_SetUpdate to update the content-type header. So if content-type already exists, it will add Content-Type as well. Should this behaviour be that a case insensitive Ns_SetIUpdate is used like the following or are there other ways around this?: https://bitbucket.org/davidqc/naviserver/branches/compare/davidqc/naviserver:tip%0Dnaviserver/naviserver:default#diff Thanks -- David Osborne Qcode Software Limited http://www.qcode.co.uk |