Middleware redirecting sometimes
Unanswered
Gazami crab posted this in #help-forum
Gazami crabOP
In my app I have logic in place that determines where to send the user based on whether or not they have a valid session. I'm doing this by using middleware and checking if they have a valid session then take them to /dashboard and if they don't it should take them to /. So when the user has a valid session when they go to root it should redirect them to /dashboard. It works fine locally but in our staging/produciton environments it works only sometimes.
I've read suggestions of adding:
response.headers.set("x-middleware-cache", "no-cache");
response.headers.set("Cache-Control", "no-store");
which made the redirection happen a little more often but it'll still sometimes not redirect
I've read suggestions of adding:
response.headers.set("x-middleware-cache", "no-cache");
response.headers.set("Cache-Control", "no-store");
which made the redirection happen a little more often but it'll still sometimes not redirect