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

Dynamic route in ignore rule not working #181

Open
benmajor opened this issue Jan 3, 2020 · 2 comments
Open

Dynamic route in ignore rule not working #181

benmajor opened this issue Jan 3, 2020 · 2 comments

Comments

@benmajor
Copy link

benmajor commented Jan 3, 2020

When a route contains a dynamic element and is passed to the ignore directive in the constructor, the route is not ignored.

For example, if the ignore directive looks like this:

'ignore' => [ '/user/{id:[0-9]+}/activate/' ]

And we visit the URL:

https://example.com/user/1/activate/

We receive the 401, because no token is passed. Is there a workaround for this?

@tuupola
Copy link
Owner

tuupola commented Jan 3, 2020

Normal regexps should work. Something like following?

'ignore' => [ '/user/[0-9]+/activate/' ]

@benmajor
Copy link
Author

benmajor commented Jan 3, 2020

Yes, that works. The issue I have is that I am actually building the ignore array from a YAML file, which also builds the routes in Slim, so it's nice to be able to use Slim's pattern for the ignore path. See the PR I have submitted, it converts Slim's patterns to PCRE-compliant strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants