Opened 14 years ago
Closed 14 years ago
#13625 closed (worksforme)
FORCE_SCRIPT_NAME bug
Reported by: | liangent | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm using FastCGI with the configuration:
FORCE_SCRIPT_NAME = '/path'
In rewrite rules, "/path/something" is rewritten to "/path/site.fcgi/something" ("something" can be blank) and "/path" is rewritten to "/path/site.fcgi"
If I visit "/path/", "^$
" is matched from urlconf, which is correct.
If I visit "/path", it looks "^path$
" is trying to be matched from urlconf, which is incorrect.
Change History (3)
comment:1 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Zeus Web Server.
Rewrite script was like:
match URL into $ with ^/path(.*) if matched set URL = /path/site.fcgi$1 endif
I had to change it to the following to make it work:
match URL into $ with ^/path/?(.*) if matched set URL = /path/site.fcgi/$1 endif
Other configurations guarantee that only /path
and /path/something
are dispatched here (ie. no /pathsomething
).
comment:3 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
I rewrote the lighttpd rewrite rule to almosy completely mimic the first Zeus Web server snippet you posted, including setting the virtual bucket mysite.fcgi
full path to "/path/mysite.fcgi"
. The only detail I had to add is the anchor $ at the end (for you case the rule would need to be "match URL into $ with ^/path(.*)$"
)
If I don't do that, again the 404 page shown isn't Django's one but Web server's.
fastcgi.server = ( "/mysite.fcgi" => ( "main" => ( "socket" => "/foo/mysite.sock", "check-local" => "disable" ) ) ) alias.url = ( "/static/admin" => "/home/ramiro/django/upstream/django/contrib/admin/media/", ) url.rewrite-once = ( "^(/static/admin.*)$" => "$1", access to both "/path" and "/path/" shows the Django view wired to the r'^$' expression in the main urls.py): "^/path(.*)$" => "/path/mysite.fcgi$1", )
And things work as expected: Access to both "/path" and "/path/" shows the Django view wired to the r'^$'
RE in the main urls.py, access to the admin app in /path/admin works without problems (logging in, CSS, JS images media serving, model CRUD, logging out).
Because all the above, I conclude this is a problem with the web server setup and therefore I'm closing this ticket.
I can't reproduce this with the following setup:
FORCE_SCRIPT_NAME
setting.)with the following relevant configuration:
setting.py:
lighttpd config:
When the web browser access
"/path"
the request doesn't even reach the Django realm, it is lighttpd the one that isn't finding a match for that path in its own configuration and showing its 404 page.If we add a rewrite rule for
"/path"
so it comes before the one we already have things work correctly (web browser access to both"/path"
and"/path/"
shows the Django view wired to ther'^$'
expression in the mainurls.py
):Note this ws what you've described but in the right order so the
"^/path$"
entry matches first.At this point it would be extremely helpful if you post the configuration files you are using (specially the Web server rewrite rules you describe in English). Please reopen this ticket only if you can provide these details about your setup.
Also, I don't know if it is wise to to configure the web server to rewrite accesses to
"/foo/"
to something underneath that"/foo"
(e.g."/path/something"
=>"/path/site.fcgi/something"
) isn't risk of recursive behavior there?.