vietj / vertx-http-proxy

A dynamic http proxy on top of Vert.x
Other
65 stars 29 forks source link

Handling redirects #3

Open itaied246 opened 7 years ago

itaied246 commented 7 years ago

I didn't see any consideration to redirects, how do you handle those? For example, if my server behind the proxy response with 302, you need to modify the response host header back to the original.

This is how apache do it: http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypassreverse

vietj commented 7 years ago

@itaied246 sorry I haven't seen your issue, if that is the custom logic of a proxy then it should be implemented otherwise, as the proxy is programmatic it should be implementable.

can you point me where the spec mentions this behavior ?

alexlehm commented 7 years ago

I don't think that is mentioned in the http rfc, however it is necessary to run a webserver behind a reverse proxy since otherwise redirects will send the browser to the internal url of the server, which is usually not correct.

vietj commented 7 years ago

so that should not be a behavior of the proxy itself but rather a rather a kind of plugin ?

alexlehm commented 7 years ago

It has to be configurable somehow, in Apache this is in the mod_proxy module, in Squid I'm not sure. If we implement a header modification plugin hook, rewrite Location could be a standard plugin

vietj commented 7 years ago

there are hooks at the moment for allowing header rewrite, look at ProxyRequestTest#testUpdateRequestHeaders

alexlehm commented 7 years ago

for the Location header we need a header rewrite of the response headers probably that is easy to implement if it isn't already there (also a response body filter would be interesting for some use-cases for elaborate filtering of the html for example)

francoisprunier commented 5 years ago

Hi @alexlehm,

That should be doable now if/when my PR #4 is merged.