Skip to content

fix(codespaces): allow Server Actions from forwarded hosts#92

Open
rajatbeladiya wants to merge 1 commit intodevelopersdigest:mainfrom
rajatbeladiya:fix/codespaces-server-actions-allowed-origins
Open

fix(codespaces): allow Server Actions from forwarded hosts#92
rajatbeladiya wants to merge 1 commit intodevelopersdigest:mainfrom
rajatbeladiya:fix/codespaces-server-actions-allowed-origins

Conversation

@rajatbeladiya
Copy link

Fixes Codespaces error:

`x-forwarded-host` header ... does not match `origin` ...
Error: Invalid Server Actions request.

Next.js Server Actions enable CSRF protection that rejects requests when the forwarded host doesn’t match the origin (common when running behind Codespaces proxy).

Changes:

  • Add next.config.mjs configuring experimental.serverActions.allowedOrigins to include *.app.github.dev.
  • Add a short README troubleshooting note.

Fixes #8

Adds Next.js config to allow Server Actions requests when running behind GitHub Codespaces proxy (x-forwarded-host != origin).

Fixes developersdigest#8.
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link

vercel bot commented Mar 5, 2026

@rajatbeladiya is attempting to deploy a commit to the developersdigest's Team Team on Vercel.

A member of the Team first needs to authorize it.

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.

Unable to run this on Github codespaces

1 participant