Closed compelinnovations closed 2 weeks ago
Hey ;)
Are you getting this error when trying to login to your admin dashboard, after setting up custom domain on the backend container in Railway?
Hi man, yes that is correct.
Okay. I saw the same behavior as you. I can see that the request is made using the CORS setting from before the domain is setup. This is because during the build phase the medusa config is generated with the provided CORS settings, and at this point in time (before setup custom domain) they are some railway doamin.
So what I did to solve it, was to redeploy the backend after setting up the domain.
Then the app will build again, but this time with the custom domain, and the medusa-config will be generated with the correct CORS url.
Please try this and let me know if you are able to login :)
Okay. I saw the same behavior as you. I can see that the request is made using the CORS setting from before the domain is setup. This is because during the build phase the medusa config is generated with the provided CORS settings, and at this point in time (before setup custom domain) they are some railway doamin.
So what I did to solve it, was to redeploy the backend after setting up the domain.
Then the app will build again, but this time with the custom domain, and the medusa-config will be generated with the correct CORS url.
Please try this and let me know if you are able to login :)
This worked! Thank you.
When I connect a custom domain to Railway, I get a CORS error.
...up.railway.app/auth/user/emailpass' from origin 'https://custom-domain' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.