From e077a0583ccccc62a60583452d39bd6d9d8241e9 Mon Sep 17 00:00:00 2001 From: 2mol <1773075+2mol@users.noreply.github.com> Date: Fri, 30 Aug 2019 14:20:17 +0200 Subject: [PATCH] give `simpleHeaders` to `simpleCorsResourcePolicy` It makes more sense to give `simpleHeaders` explicitely to the `simpleCorsResourcePolicy`, and by extension to `simpleCors`. The reason for this is that the preflight request chrome and firefox make vie OPTIONS includes `content-type`, resulting in a 400. As the documentation states, all `simpleHeaders` _except_ `content-type` are implicit when passing the empty list to `corsRequestHeaders`. I hope this is ok, let me know if I misunderstood the intention regarding `simpleCors`. --- src/Network/Wai/Middleware/Cors.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Network/Wai/Middleware/Cors.hs b/src/Network/Wai/Middleware/Cors.hs index 16f2743..fe0b904 100644 --- a/src/Network/Wai/Middleware/Cors.hs +++ b/src/Network/Wai/Middleware/Cors.hs @@ -225,7 +225,7 @@ simpleCorsResourcePolicy ∷ CorsResourcePolicy simpleCorsResourcePolicy = CorsResourcePolicy { corsOrigins = Nothing , corsMethods = simpleMethods - , corsRequestHeaders = [] + , corsRequestHeaders = simpleHeaders , corsExposedHeaders = Nothing , corsMaxAge = Nothing , corsVaryOrigin = False