Role-based Redirects not working as expected

I have a _redirects file sitting in the site/static with the following content:

/analytics/*	  200!	Role=admin
/analytics/*	/index.html	301!
/leaderboards/*   200!	Role=user,admin
/leaderboards/* /index.html	301!

Currently whenever I hit one of those urls, regardless of if I’m logged in through Identity (as admin) or not, I get kicked back to root. Oddly enough this issue isn’t persistent - sometimes the role redirects work properly, sometimes they don’t. Every time I modify _redirects this issue has a chance of appearing again. I’m sure I’m doing something wrong so I appreciate any help!

hi there, we were having some issues with redirects earlier today - see our Status Page but it should be resolved now. Will you try clearing your netlify cache, re-deploying and seeing if the issue still persists?

Hi @perry, unfortunately redeploying with cache clearing didn’t fix the issue. For context, I removed the site-wide password and set a trivial string as the JWT “secret”, but I noticed that there is no “nf_jwt” cookie being set (at least what I can tell from my browser) and I wonder if that’s the reason why the redirects never authenticate me (even though netlifyIdentity.currentUser() does show me as logged in)

Hi @vdadfar, can you share a URL that you’re using to test? Also if you don’t have an nf_jwt cookie sent with your request then we won’t be able to authenticate it. Can you check if the cookie is being sent when it fails?

Sure, I use either or (or /index.html) and both are blocked even while logged in. And the cookie isn’t stored on my browser even during failure. Does the identity widget always send an nf_jwt cookie, or is there a way to disable it that I might have triggered?

@vdadfar I’m looking for the actual URL you are using to test. I can’t test a fake URL :slight_smile: