1. Dustin Hatch
  2. Milla
  3. Issues
Issue #7 resolved

Incorrect redirect to /

Dustin Hatch
repo owner created an issue

Not entirely certain what causes this, but here's what I know:

  • WSGIScriptAlias is a subdirectory without a trailing slash (i.e. /foo)
  • Dispatcher is milla.dispatch.routing.Router with trailing_slash=Router.REDIRECT
  • Client accesses path without trailing slash (i.e. http://example.org/foo) expecting to be redirected (i.e. to http://example.org/foo/)
  • Client is redirected incorrect location (i.e. http://example.org/)

Comments (1)

  1. Dustin Hatch reporter

    routing: Correctly redirect when path info is empty (fixes #7)

    When the application path info is empty (e.g. the WSGI script is mounted somewhere other than the root), appending a trailing slash and redirecting causes the new location to be calculated incorrectly. This is because the part of the request URL before the application path is not taken into account, so the new path always ends up being a literal /. This commit changes the behavior of the redir function that is returned by milla.dispatch.routing.Router.resolve to calculate the new path info correctly in the redirect response.

    → <<cset d8df6689aa82>>

  2. Log in to comment