Ticket #7215 (new enhancement)
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
Note: See
TracTickets for help on using
tickets.


