Opened 9 years ago

Closed 9 years ago

#3850 defect closed duplicate (duplicate)

bug in prePathURL breaks proxies (8.2.0)

Reported by: jamesyonan Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Work around a bug in twisted 8.2.0 prePathURL function that breaks HTTP proxies by not properly respecting port numbers in Host: foo.bar.com:<port> style headers. As a result of the incorrect behavior, HTTP redirections fail if an HTTP proxy or IP-stack-level port forward rule remaps the port number of the request so that the port number in the Host header is different from the port number of the receiving transport.

For example, suppose I have a port forward rule on my server (foo.bar.com) to redirect port 8443 on my public interface to 127.0.0.1:5000 where a twisted web server is listening. Now I connect with a web browser to http://foo.bar.com:8443/ and get this wrong redirect:

Location: https://foo.bar.com:5000/__session_key__3ba5281f1d7598ef02b0e314ef28f6e5/

Of course, the bug is that twisted should have used port 8443 from the HTTP request instead of port 5000 from the transport to build the redirect. This bug will break any port-remapping proxy or forward rule.

I am submitting a patch as well to fix the issue.

Attachments (1)

prepath.patch (2.2 KB) - added by jamesyonan 9 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 9 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

Hi jamesyonan. Thanks for coming back to file this. I noticed the problem earlier and filed this for you, #3845. Please attach your patch there. Thanks!

Changed 9 years ago by jamesyonan

Attachment: prepath.patch added

comment:2 Changed 7 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.