Hello, I have a problem with my railway deployement, my front has been successfully deployed on netlify and my back on railway, both are successfully linked and I can create an account, but my problem is that I can't login myself, I have a problem with my cookies, I suppose.
I had this error message :
Access to XMLHttpRequest at 'https://[my-back-url].adaptable.app/jwtid' from origin 'https://[my-front-url].netlify.app/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
until I put this cors option :
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content, Accept, Content-Type, Authorization"
);
res.setHeader("Access-Control-Allow-Credentials", "true");
res.setHeader(
"Access-Control-Allow-Methods",
"GET, POST, PUT, DELETE, PATCH, OPTIONS"
);
next();
});
because just puting my front url didn't work, then I had to erase all my withcredentials : true from my front (because I had an error of incompatibility of "Access-Control-Allow-Origin : *" and credentials on true)
That was ok, no error message but I stilled can't login, the cookie doesn't appear...)
I've read that a custom domain could make it work, but I can't buy a domain for that (src : #1048780024691556372 message)
Can anyone help me ? Do anyone have already had this problem or have an idea to resolve it ?
(I'm french, so forgive my bad english 🤦♀️ )
Thanks for reading me and have a nice evening 😊 !
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
