15.3.1 middleware issue #79643
-
SummaryI am using middleware to redirect my user. Somehow all other paths are protected, just not /login path. /login path is placed under (auth) group routes. here is the code:
Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
it will work on localhost. But not on production. I made sure I deleted .next and rebuild, no luck. |
Beta Was this translation helpful? Give feedback.
-
I even tried something crazy.
but still, not working for /login, working for all other routes |
Beta Was this translation helpful? Give feedback.
-
Are you using next-auth? If so, it might be related to the next-auth configuration. |
Beta Was this translation helpful? Give feedback.
-
Hi, Did you try using an incognito mode? I wonder if your browser got a permanent redirect stored. If it works on incognito mode, then it can be a browser caching issue. |
Beta Was this translation helpful? Give feedback.
-
hi all it is working now. It's my nginx config issue. before: after edited:
not sure why I have to change 127.0.0.1 to localhost in order to work. Thanks for the help |
Beta Was this translation helpful? Give feedback.
hi all it is working now. It's my nginx config issue.
before:
location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
after edited:
location / { proxy_pass http://localhost:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
not sure why I have to change 127.0.0.1 to localhost in order to work. Thanks for the help