purescript-payload icon indicating copy to clipboard operation
purescript-payload copied to clipboard

OPTIONS handler for pre-flight CORS request

Open mikesol opened this issue 4 years ago • 2 comments

I was wondering how one would go about implementing a handler for pre-flight CORS requests? Thanks!

mikesol avatar Sep 23 '20 14:09 mikesol

Unfortunately the OPTIONS method is not supported at the moment, and I don't believe there are good workarounds. I made another issue to track that: https://github.com/hoodunit/purescript-payload/issues/11. After that is added the way to do CORS would probably be through a request guard, but it might need a little more thought.

hoodunit avatar Sep 24 '20 06:09 hoodunit

Adding endpoints with the OPTIONS method is now supported with the v0.3.1 changes. This still doesn't quite support this use case, however, without some awkward workarounds (like adding OPTIONS endpoints manually for each endpoint that needs it). But I think with a little re-work this use case can be supported via request guards.

hoodunit avatar Oct 04 '20 18:10 hoodunit