geniusyield / atlas

Application backend for Plutus smart contracts on Cardano
https://atlas-app.io
Apache License 2.0
67 stars 18 forks source link

Request blocked by CORS policy #357

Closed Fiftyw3bs closed 2 weeks ago

Fiftyw3bs commented 1 month ago

Has anyone encountered the following error message while trying to send requests?

Access to XMLHttpRequest at 'http://localhost:8222/create' from origin 'http://localhost:3004' 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.

Can't figure out how to remedy the issue.

My cors config currently looks like this (after trying both the example and many variations):


app :: Ctx -> Application
app ctx = cors (const $ Just simpleCorsResourcePolicy { corsOrigins = Just (["http://127.0.0.1:3004"],  True),  corsRequestHeaders = [HttpTypes.hContentType, HttpTypes.hAccept, HttpTypes.hAuthorization] }) $ serve appApi $ hoistServer appApi (Handler . ExceptT . try)  $ apiServer ctx```
sourabhxyz commented 1 month ago

Hi mate, this isn't really related to Atlas. I would suggest creating a simple reproducible example (just a dummy server) and trying to debug with it (perhaps mention at stackoverflow?), can also describe raw request which is being blocked.

sourabhxyz commented 2 weeks ago

Since there has been no activity in this issue for a while, I'll be closing it. Feel free to reopen it.