atlas icon indicating copy to clipboard operation
atlas copied to clipboard

Request blocked by CORS policy

Open Fiftyw3bs opened this issue 1 year ago • 1 comments

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```

Fiftyw3bs avatar Sep 28 '24 04:09 Fiftyw3bs

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 avatar Oct 01 '24 07:10 sourabhxyz

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

sourabhxyz avatar Nov 04 '24 09:11 sourabhxyz