titanium-web-proxy icon indicating copy to clipboard operation
titanium-web-proxy copied to clipboard

Problem when the host is changed

Open BarakHirsch opened this issue 9 years ago • 5 comments

Hey, When using the proxy, I've noticed that redirects to different hosts are redirected to the original host. It looks like the connection is reused even if the target host is changed. I've managed to implement a workaround with setting the Connection header to 'Close' in BeforeResponse so the connection would not be reused, but it looks like a bug in the code.

BarakHirsch avatar Jun 13 '17 08:06 BarakHirsch

Are you making request from a Browser? I am not sure if this is a standard behavior in HTTP protocol.

Currently we don't expect a single connection from client to change host-names, proxy will reuse the same connection to server (from IP of first client request host name) until the end of client connection. If client wants to connect to another host name it should create another connection to the new host via the proxy.

Having said the if different host names on subsequent requests all point to same server it shouldn't be a problem, since we already have a connection to the same server.

justcoding121 avatar Jun 13 '17 15:06 justcoding121

I'm using the proxy with a selenium web driver, which is a browser used from code. When a site redirects to a different one the call is still persisted to the original site, even though the target server is a different one. Maybe a check for the host header could be enough to ensure that the connection can be reused.

BarakHirsch avatar Jun 13 '17 16:06 BarakHirsch

We can update the behavior on Proxy to drop the current server connection and create a new server connection when host name changes without dropping the client connection.

justcoding121 avatar Jun 13 '17 17:06 justcoding121

I'm less familiar with these topics, that's why I open and issue instead of submitting a merge request. It sounds like is should work...

BarakHirsch avatar Jun 14 '17 06:06 BarakHirsch

Should be fixed in latest develop

justcoding121 avatar Jun 15 '17 01:06 justcoding121