#437 closed defect (fixed)
Ticket URL in email notifications is incorrect when Trac is behind mod_proxy
Reported by: | Owned by: | Christopher Lenz | |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | web frontend/mod_python | Version: | 0.8 |
Severity: | normal | Keywords: | |
Cc: | manuzhai@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I have Trac running on Apache 2 on port 8000, with Apache 1.3 on port 80 forwarding certain paths to Apache 2 using mod_proxy. Trac generates incorrect 'Ticket URL' links in the footer of email notifications. The URL that it generates is of the form http://libmsn.bluewire.org.nz:8000/dev/ticket/1 when the expected URL is http://libmsn.bluewire.org.nz/dev/ticket/1.
Attachments (4)
Change History (18)
by , 21 years ago
Attachment: | trac-r574-X-Forwarded-Host.patch added |
---|
comment:1 by , 21 years ago
Milestone: | → 0.7.1 |
---|
comment:2 by , 21 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 21 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 by , 20 years ago
Cc: | added |
---|---|
Milestone: | 0.7.1 → 0.8.1 |
Resolution: | fixed |
Status: | closed → reopened |
Version: | 0.7 → 0.8 |
This should also be fixed in the ModPythonHandler. Patch attached.
I still have a bit of a problem with this, though. I have Trac running within a virtual host running on port 88. Port 80 is used for web things only accessible to the LAN, and port 80 on the remote interface is forwarded to port 88. Trac now thinks that it's running on remote-host:88, while it's actually running on remote-host:80.
This is probably not very easy to detect automatically. Would it be useful to add a configuration option, or should I just manually change this in the source?
comment:5 by , 20 years ago
Cc: | added; removed |
---|
comment:6 by , 20 years ago
We now have a base_url
option in TracIni, it just need to be used everywhere where it makes sense (patches welcome ;-).
comment:7 by , 20 years ago
Cool! I'll have a look at it. ;)
By the way, do you think it would be feasible to update trac.ini with any new configuration options on an environment upgrade? I think that might be useful.
comment:8 by , 20 years ago
Adding patches that make use of this option in ModPythonHandler and core.
by , 20 years ago
Attachment: | modpybaseopt.diff added |
---|
Use base_url option. This patch obsoletes fwhostmpr.diff
by , 20 years ago
Attachment: | corebaseopt.diff added |
---|
Use the base_url option, in the core CGI handler.
comment:9 by , 20 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
I'm going to test your patches, thanks.
comment:10 by , 20 years ago
Status: | new → assigned |
---|
comment:11 by , 20 years ago
Component: | general → mod_python frontend |
---|
comment:12 by , 20 years ago
Milestone: | 0.8.1 → 0.9 |
---|
The base_url
option has been added after the 0.8 release (in [1092]), and I'd rather not backport it at this point. Retargetting to 0.9.
BTW, I don't think getting the headers from the environment can work under mod_python (as in fwhostmpr.diff
). Am I missing something here?
comment:13 by , 20 years ago
Keeping it in the trunk for 0.9 makes sense, then.
Actually, you might be right. But I think that patch is mostly moot anyway as people with proxies and the like should now start useing the base_url
option.
comment:14 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hmm, #863 is fixed, which is actually a duplicate of this ticket (historically). So let's close this one two.
Patch which retrieves base URL from X-Forwarded-Host header that mod_proxy adds.