#30895: Multiples trailing slashes appended to URL
----------------------------------+--------------------------------------
Reporter: Conor Cunningham | Owner: nobody
Type: Bug | Status: closed
Component: Core (URLs) | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: urls, url | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Carlton Gibson):
* status: new => closed
* resolution: => invalid
Comment:
Hi Conor.
I think this is a mis-understanding on your part here. Alas, it's not
something we can address directly on the issue tracker. See
TicketClosingReasons/UseSupportChannels, which I know is where you began…
`APPEND_SLASH` does not affect the available URLs. Rather it tries an
additional request to the same URL (if it's missing a slash) to see if
that matches. Docs for `APPEND_SLASH`.
> When set to True, if the request URL does not match any of the patterns
in the URLconf and it doesn’t end in a slash, an HTTP redirect is issued
to the same URL with a slash appended.
So I'd try `api/v1/case`, get a 404 and be redirected to `api/v1/case/` to
give that a chance to match.
See the docs for [https://docs.djangoproject.com/en/2.2/topics/http/urls
#including-other-urlconfs Including other URLconfs] to get your
configuration correct. Note the examples look like this:
{{{
from django.urls import include, path
urlpatterns = [
# ... snip ...
path('community/', include('aggregator.urls')),
path('contact/', include('contact.urls')),
# ... snip ...
]
}}}
i.e. they do include the trailing slash when using `include()`.
(From your screenshot, I'd guess `api/v1case` would match, but that's not
what you're intending...)
Good luck.
--
Ticket URL: <https://code.djangoproject.com/ticket/30895#comment:3>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.899f552310b757ea5dd145cfbe266142%40djangoproject.com.