Temporary cors error
theahmadjalalTRIAL
6 months ago
Access to XMLHttpRequest at 'https://ems-server-development-production.up.railway.app/api/v1/auth/login' from origin 'https://test.smartpathpk.com' 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.
Getting this cors error while deploy backend on railways but this error automatically resolve after few hours but obviously it is causing hours of delay to work backend properly, although i have set the cors policy ass below:
const app = express();
//middlewares
app.use(
cors({
origin: "https://test.abc.com",
credentials: true,
methods: ["POST", "GET", "PUT", "DELETE"],
})
);
app.use(express.json());
0 Replies