a year ago
Access to XMLHttpRequest at 'https://fixitowner-production.up.railway.app/api/admin/dashboard/get' from origin 'https://fixity.netlify.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Cors issue even tho, my backend looks fine
const corsOptions: CorsOptions = { origin: 'https://fixity.netlify.app', methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'], credentials: true, exposedHeaders: ['Set-Cookie'], }; app.use(cors(corsOptions)); app.options('*', cors(corsOptions));
Pinned Solution
a year ago
Hey, can you try setting the header explicitly using a middleware?
7 Replies
a year ago
.
uxuz
Hey, there is no `Access-Control-Allow-Origin` header. 
a year ago
Access-Control-Allow-Origin header exist when I use render, but when I try to use railway.
All of a sudden not access control allow origin
temuujin-bat
`Access-Control-Allow-Origin` header exist when I use render, but when I try to use railway. All of a sudden not access control allow origin
a year ago
Does your application include the Access-Control-Allow-Origin header when run locally?
uxuz
Does your application include the `Access-Control-Allow-Origin` header when run locally?
a year ago
yes
temuujin-bat
yes
a year ago
Hey, can you try setting the header explicitly using a middleware?
uxuz
Hey, can you try setting the header explicitly using a middleware?
a year ago
You are my savior ❤ xD
Status changed to Solved parmstar • 12 months ago