Opened 6 months ago

Closed 5 months ago

#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


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

WSGIScriptAlias /some_prefix /path/to/

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 6 months ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 6 months ago by til

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

Changed 6 months ago by til

comment:2 Changed 5 months ago by bpeschier

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

This is a duplicate of #21579

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.