Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#437 closed defect (fixed)

Ticket URL in email notifications is incorrect when Trac is behind mod_proxy

Reported by: mrowe@… 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:

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)

trac-r574-X-Forwarded-Host.patch (642 bytes ) - added by mrowe@… 15 years ago.
Patch which retrieves base URL from X-Forwarded-Host header that mod_proxy adds.
fwhostmpr.diff (788 bytes ) - added by Manuzhai 15 years ago.
Patch for #437 wrt ModPythonHandler.
modpybaseopt.diff (425 bytes ) - added by Manuzhai 15 years ago.
Use base_url option. This patch obsoletes fwhostmpr.diff
corebaseopt.diff (336 bytes ) - added by Manuzhai 15 years ago.
Use the base_url option, in the core CGI handler.

Download all attachments as: .zip

Change History (18)

by mrowe@…, 15 years ago

Patch which retrieves base URL from X-Forwarded-Host header that mod_proxy adds.

comment:1 by daniel, 15 years ago

Milestone: 0.7.1

comment:2 by daniel, 15 years ago

Owner: changed from Jonas Borgström to daniel
Status: newassigned

comment:3 by daniel, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [581] (merged in [582]).

comment:4 by Manuzhai, 15 years ago

Cc: mail@… added
Milestone: 0.7.10.8.1
Resolution: fixed
Status: closedreopened
Version: 0.70.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?

by Manuzhai, 15 years ago

Attachment: fwhostmpr.diff added

Patch for #437 wrt ModPythonHandler.

comment:5 by anonymous, 15 years ago

Cc: manuzhai@… added; mail@… removed

comment:6 by Christopher Lenz, 15 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 Manuzhai, 15 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 Manuzhai, 15 years ago

Adding patches that make use of this option in ModPythonHandler and core.

by Manuzhai, 15 years ago

Attachment: modpybaseopt.diff added

Use base_url option. This patch obsoletes fwhostmpr.diff

by Manuzhai, 15 years ago

Attachment: corebaseopt.diff added

Use the base_url option, in the core CGI handler.

comment:9 by Christopher Lenz, 15 years ago

Owner: changed from daniel to Christopher Lenz
Status: reopenednew

I'm going to test your patches, thanks.

comment:10 by Christopher Lenz, 15 years ago

Status: newassigned

comment:11 by Christopher Lenz, 15 years ago

Component: generalmod_python frontend

comment:12 by Christopher Lenz, 15 years ago

Milestone: 0.8.10.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 Manuzhai, 15 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 Christopher Lenz, 15 years ago

Resolution: fixed
Status: assignedclosed

Hmm, #863 is fixed, which is actually a duplicate of this ticket (historically). So let's close this one two.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.