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

fix: few ui actions not working right after login #301

Closed
wants to merge 309 commits into from

Conversation

gchust
Copy link

@gchust gchust commented Apr 4, 2024

Fix the issue #300

Default Response.redirect after login is a 302 redirect.
And it will block logout and Clear history operation right after login
20240404173719_rec_

After changing to 307 redirect, this is working correctly now, and we can logout successfully.
image

Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302 and

https://nextjs.org/docs/pages/api-reference/next-config-js/redirects#header-cookie-and-query-matching

Why does Next.js use 307 and 308? Traditionally a 302 was used for a temporary redirect, and a 301 for a permanent redirect, but many browsers changed the request method of the redirect to GET, regardless of the original method. For example, if the browser made a request to POST /v1/users which returned status code 302 with location /v2/users, the subsequent request might be GET /v2/users instead of the expected POST /v2/users. Next.js uses the 307 temporary redirect, and 308 permanent redirect status codes to explicitly preserve the request method used.

Copy link

vercel bot commented Apr 4, 2024

@gchust is attempting to deploy a commit to the Uncurated Tests Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@athrael-soju athrael-soju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

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

Successfully merging this pull request may close these issues.

None yet