#21749 closed Bug (duplicate)

LocaleMiddleware creates wrong redirects when combined with script prefix

Reported by: til 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 til 20 months ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 20 months ago by til

  • Cc til@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Changed 20 months ago by til

comment:2 Changed 19 months ago by bpeschier

  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #21579

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