Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants