Edgewall Software
Modify

Opened 17 years ago

Last modified 10 years ago

#7215 new enhancement

Default to base_path if SCRIPT_NAME not set for tracd

Reported by: mail+trac@… Owned by:
Priority: low Milestone: next-major-releases
Component: web frontend/tracd Version: 0.11rc1
Severity: normal Keywords: proxy verify
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I'm not sure if this is an issue with the deployment at Dreamhost PS w/ the domain proxy, but this is a work-around that could prove useful in other situations, too.

Setup: domain.tld/project ⇒ proxied to localhost:8000

Then, starting standalone tracd as follows:

$ tracd --base-path=/project -e ~/trac

SCRIPT_NAME in BasePathMiddleware is unset, so all requests go to /<project> instead of /project/<project>

This patch fixes the problem by defaulting to base_path if there's nothing better available:

--- trac/web/standalone.py.orig 2008-05-09 02:09:51.195020000 -0700
+++ trac/web/standalone.py      2008-05-09 02:10:09.201738000 -0700
@@ -92,6 +92,9 @@
         self.application = application
 
     def __call__(self, environ, start_response):
+        if not environ.get('SCRIPT_NAME', ''):
+            environ['SCRIPT_NAME'] = self.base_path
+
         path = environ['SCRIPT_NAME'] + environ.get('PATH_INFO', '')
         environ['SCRIPT_NAME'] = self.base_path
         environ['PATH_INFO'] = path[len(self.base_path):]

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 17 years ago

Keywords: verify added
Milestone: 0.12

Interesting, thanks for the patch!

comment:2 by Christian Boos, 14 years ago

Keywords: proxy added
Priority: normallow
Severity: majornormal

comment:3 by Ryan J Ollos, 10 years ago

Owner: Jonas Borgström removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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