Calling the backend from a different domain
Im using a domain example.com for the client and myserver.railway.app for the backend. However, im getting a CORS error on this setup, Is there a way around it?
Access to XMLHttpRequest at 'myserver.railwayapp.com/operations/tasks' from origin 'example.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.
1 Reply
Check out CORS customisation through custom middleware https://wasp-lang.dev/docs/guides/middleware-customization#1-customize-global-middleware
Middleware Customization | Wasp
Wasp comes with a minimal set of useful Express middleware in every application. While this is good for most users, we realize some may wish to add, modify, or remove some of these choices both globally, or on a per-api/path basis.