a year ago
Hey, i'm having an issue with an app deployed. I'm sending a post request to the app and I get a 402 saying "failed to forward request to upstream: connection reset by peer"
The preflight OPTIONS method request is OK.
The origin source says:
Access to XMLHttpRequest at 'https://project1-production-c04f.up.railway.app/vqa' from origin 'https://project-1-omega-swart.vercel.app/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Any hints or hunches about this?
I've read part of the docs about networking but I don't see what could solve my issue
2 Replies
So this looks like your app needs to be configured to accept requests from Vercel because you're crossing boundaries. At the minimum you'll need an Access-Control-Allow-Origin header (I'm not sure how your app is configured so precisely how you want to do that is up to you). You'll probably need a cors package in whatever programming language/package manager you're using, and you'll need to set an origin from Vercel (I'd set this dynamically with an environment variable so you can change it from the variables on your service should it change)