Cors Issue
temuujin-bat
HOBBYOP

6 months 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));

Solved$10 Bounty

7 Replies

uxuz
MODERATOR

6 months ago

Hey, there is no Access-Control-Allow-Origin header.

Attachments


temuujin-bat
HOBBYOP

6 months ago

.


uxuz

Hey, there is no Access-Control-Allow-Origin header.

temuujin-bat
HOBBYOP

6 months 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

uxuz
MODERATOR

6 months 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?

temuujin-bat
HOBBYOP

6 months ago

yes


temuujin-bat

yes

uxuz
MODERATOR

6 months ago

Hey, can you try setting the header explicitly using a middleware?


uxuz

Hey, can you try setting the header explicitly using a middleware?

temuujin-bat
HOBBYOP

6 months ago

You are my savior xD


Status changed to Solved parmstar 6 months ago


Loading...