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));
7 Replies
6 months ago
.
uxuz
Hey, there is no Access-Control-Allow-Origin header.
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
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?
6 months ago
yes
temuujin-bat
yes
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?
6 months ago
You are my savior
xD
Status changed to Solved parmstar • 6 months ago