Edgewall Software

Ticket #7215 (new enhancement)

Opened 7 months ago

Last modified 7 months ago

Default to base_path if SCRIPT_NAME not set for tracd

Reported by: mail+trac@… Owned by: jonas
Priority: normal Milestone: 0.13
Component: web frontend/tracd Version: 0.11rc1
Severity: major Keywords: verify
Cc:

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

Change History

Changed 7 months ago by cboos

  • keywords verify added
  • milestone set to 0.12

Interesting, thanks for the patch!

Add/Change #7215 (Default to base_path if SCRIPT_NAME not set for tracd)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
The owner will change from jonas to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.