1

Is it possible to avoid url redirections to url/ in Django/DjangoRestFramework? My point is that some frontend developers use url without trailing slashes and Django redirects such requests to url/ which slows down the API.

Adding

APPEND_SLASH = False

to settings doesn't solve the problem as it returns 404 responses.

Milano
  • 18,048
  • 37
  • 153
  • 353
  • Does this answer your question? [How can I make a trailing slash optional on a Django Rest Framework SimpleRouter](https://stackoverflow.com/questions/46163838/how-can-i-make-a-trailing-slash-optional-on-a-django-rest-framework-simplerouter) – Andrew Aug 22 '21 at 09:01
  • There is also this: https://docs.djangoproject.com/en/dev/ref/settings/#append-slash. These are both _trival_ google searches, and both point right back to stack overflow. https://stackoverflow.com/questions/68875343/make-django-drf-accept-urls-without-trailing-slash – Andrew Aug 22 '21 at 09:02
  • @Andrew I explicitly wrote that `APPEND_SLASH=False` is not an option. It needs to be without a redirect and yes, I came across the first solution and I used it already, thanks. – Milano Aug 24 '21 at 20:02

0 Answers0