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 Server Action redirection with absolute, basePath not matched external URL #65375

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

levinqdl
Copy link

@levinqdl levinqdl commented May 5, 2024

What?

When redirecting to an external URL, which has the same origin, but does not match basePath, Next.js takes it as an internal URL, and responses the 404 page unexpectedly.

Why?

It's because it has not been considered whether the basePath is matched when handling the redirection.

How?

This PR resolves the issue by comparing the redirecting URL pathname prefix with the basePath.

Fixes #65257

@ijjk
Copy link
Member

ijjk commented May 5, 2024

Allow CI Workflow Run

  • approve CI run for commit: 27e5ca0

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

1 similar comment
@ijjk
Copy link
Member

ijjk commented May 5, 2024

Allow CI Workflow Run

  • approve CI run for commit: 27e5ca0

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redirect to url with a different base path in server action does not work
2 participants