From a0577ba2493d62c11ba57694f87f207109681a7d Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 21 Nov 2020 18:13:58 +0100 Subject: [PATCH] Add CORS --- Application.hs | 3 ++- gonito.cabal | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Application.hs b/Application.hs index e93376d..63e5d75 100644 --- a/Application.hs +++ b/Application.hs @@ -28,6 +28,7 @@ import Network.Wai.Middleware.RequestLogger (Destination (Logger), IPAddrSource (..), OutputFormat (..), destination, mkRequestLogger, outputFormat) +import Network.Wai.Middleware.Cors import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet, toLogStr) @@ -145,7 +146,7 @@ makeApplication foundation = do -- Create the WAI application and apply middlewares appPlain <- toWaiAppPlain foundation - return $ logWare $ defaultMiddlewaresNoLogging appPlain + return $ logWare $ defaultMiddlewaresNoLogging $ simpleCors appPlain makeLogWare :: App -> IO Middleware makeLogWare foundation = diff --git a/gonito.cabal b/gonito.cabal index 7010502..78722a4 100644 --- a/gonito.cabal +++ b/gonito.cabal @@ -151,6 +151,7 @@ library , megaparsec , Glob , req + , wai-cors executable gonito if flag(library-only)