Opened 3 years ago

Closed 3 years ago

#21749 closed Bug (duplicate)

LocaleMiddleware creates wrong redirects when combined with script prefix

Reported by: Tilman Koschnick Owned by: nobody
Component: Internationalization Version: 1.6
Severity: Normal Keywords:
Cc: til@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a Django instance is mounted with a prefix, e.g. with

WSGIScriptAlias /some_prefix /path/to/wsgi.py

and i18n_patterns are used, the generated redirect urls have the language prefix before the script prefix, e.g.:

http://host/some_prefix/some_path/ -> http://host/en/some_prefix/some_path/

Correct would be to put the language prefix between script prefix and the rest of the path:

http://host/some_prefix/some_path/ -> http://host/some_prefix/en/some_path/

The attached patch fixes this, pulling the required bits from request.META.

Attachments (1)

locale_middleware_redirect.diff (969 bytes) - added by Tilman Koschnick 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 3 years ago by Tilman Koschnick

Cc: til@… added

Changed 3 years ago by Tilman Koschnick

comment:2 Changed 3 years ago by Bas Peschier

Resolution: duplicate
Status: newclosed

This is a duplicate of #21579

Note: See TracTickets for help on using tickets.
Back to Top