Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-site POST form submissions are forbidden

My sveltekit app has a form which sends a POST request to server. The app is working fine on dev server but when I build and run the app it fails to send the form data via POST request. It shows the following error in the browser:

Cross-site POST form submissions are forbidden

like image 615
Shakir Avatar asked Aug 30 '25 15:08

Shakir


1 Answers

You have to set the the ORIGIN env var like this

ORIGIN=http://localhost:3000 node build/index.js

https://github.com/sveltejs/kit/tree/master/packages/adapter-node#origin-protocol_header-and-host_header

like image 170
Evan Avatar answered Sep 02 '25 12:09

Evan