Modify ↓
Opened 18 years ago
Last modified 11 years ago
#7215 new enhancement
Default to base_path if SCRIPT_NAME not set for tracd
| Reported by: | 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 , 18 years ago
| Keywords: | verify added |
|---|---|
| Milestone: | → 0.12 |
comment:2 by , 15 years ago
| Keywords: | proxy added |
|---|---|
| Priority: | normal → low |
| Severity: | major → normal |
comment:3 by , 11 years ago
| Owner: | removed |
|---|
Note:
See TracTickets
for help on using tickets.



Interesting, thanks for the patch!