Changes between Version 1 and Version 5 of Ticket #32005


Ignore:
Timestamp:
Sep 17, 2020, 7:26:47 PM (4 years ago)
Author:
Alex Vandiver
Comment:

Fair enough. The only slight ugliness with subclassing is that one needs to repeat the logic that adds `Content-Language` and `Vary` headers -- skipping all of the process_response on 404s wouldn't produce the right headers. Which actually means a reasonable amount of code duplication.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32005

    • Property Resolutionwontfix
    • Property Status newclosed
  • Ticket #32005 – Description

    v1 v5  
    11This is related to the last two comments on #17734.  Specifically, if an application decides to return an explicit 404, there is no way to prevent the LocaleMiddleware from overriding this and trying the language redirect.
    22
    3 In those comments, it was about catch-all URL patterns.  I'm running into something related, but slightly different -- we [https://github.com/zulip/zulip/blob/master/zerver/middleware.py#L434 serve 404's for the `/` endpoint if the subdomain isn't valid], which the LocaleMiddleware unhelpfully redirects to (e.g.) `/en/` which isn't any less of a 404.
     3In those comments, it was about catch-all URL patterns.  I'm running into something related, but slightly different -- we [https://github.com/zulip/zulip/blob/536bd3188e9428993fd712ed2f0df7c160b6ad60/zerver/middleware.py#L453 serve 404's for the `/` endpoint if the subdomain isn't valid], which the LocaleMiddleware unhelpfully redirects to (e.g.) `/en/` which isn't any less of a 404.
    44
    55Would folks be amenable to a patch which disabled the auto-404-redirect functionality in the middleware with a flag of some sort?
Back to Top