#19594: urlpatterns not respected for trailling slashed when mod_rewrite is on
------------------------------+-------------------------------------
Reporter: francisl | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.2
Severity: Normal | Keywords: mod_rewrite urlpatterns
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------------------
'django.core.handlers.base.get_script_name' behaves strangely when extra
slashes are added at the end of a URL and FORCE_SCRIPT_NAME is not set.
The returned value will repeat the URL if extra slashes is added.
This will lead to a 404
If there is a regex explicitly accepting extra slashes, it will be ignored
This condition is not the expected behavior, but there is also no reason
to return an erroneous response and to prevent the resolver to do its work
e.g. :
Requested /api/news//?key=value
Returns //api/news/
Requested /api/news///?key=value
Returns /a/api/news
The "/a" is the URL starting to repeat itself.
How to reproduce:
Run django with wsgi, apache and mod_rewrite on
Request urls with extra ending slashes
Workaround:
Set FORCE_SCRIPT_NAME = "" in the settings.
Since FORCE_SCRIPT_NAME isn't defaulted, it can lead to confusion and make
this strange behavior hard to debug.
Solution:
Don’t add the SCRIPT_URL to the PATH_INFO if FORCE_SCRIPT_NAME is not set.
See patch.txt
This also affect django to 1.5
--
Ticket URL: <https://code.djangoproject.com/ticket/19594>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.