Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route param 'redirect_trailing_slash' can create redirect loop #259

Open
joelsdc opened this issue Jun 28, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@joelsdc
Copy link

commented Jun 28, 2019

What version of aah are you using (aah --version)?

v0.12.3

Does this issue reproduce with the latest release?

Yes.

What operating system are you using (such as macOS, Linux and Windows)?

macOS (haven't verified on other systems)

What did you do?

  1. Create a simple service, with a subroute (/something/:xxx)

Example routes.conf:

    routes {
      test {
        path = "/test/:something"
        controller = "SomeController"
        action = "SomeAction"
        }
      }
    }
  1. Routes.conf redirect_trailing_slash must be set to true.
  2. Make a request to .../test

What did you expect to see?

Expected:

GET http://localhost:8080/test --> Route not found, Host: localhost:8080, Path: /test

What did you see instead?

A redirect-loop:

GET http://localhost:8080/test --> 

RedirectTrailingSlash: 302, /test ==> http://localhost:8080/test/
Redirecting to 'http://localhost:8080/test/' with status '302'

And now if we do:

GET http://localhost:8080/test/ --> 

RedirectTrailingSlash: 302, /test/ ==> http://localhost:8080/test
Redirecting to 'http://localhost:8080/test' with status '302'

So http://localhost:8080/test gets redirected to http://localhost:8080/test/ and again http://localhost:8080/test/ to http://localhost:8080/test

Additional context

WORKAROUND: I'm not even sure if this is a bug or expected, but setting routes.conf redirect_trailing_slash to false solves this.

@jeevatkm

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

@joelsdc This is expected behavior in redirect trailing slash feature.

  • When requested with http://localhost:8080/test/ sending to http://localhost:8080/test
  • When requested with http://localhost:8080/test sending to http://localhost:8080/test/

However, as described above it shouldn't do loop. Looping seems bug, need investigation and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.