Revert "Fixed indentation"

This reverts commit 52cf633993.
This commit is contained in:
James Burton 2021-02-09 12:07:56 +00:00
parent 52cf633993
commit 8a4fb790cf

View File

@ -174,28 +174,28 @@ reverseProxy opts appPortVar = do
manager manager
defaultSettings' = maybe id (setHost . fromString) (develHost opts) defaultSettings defaultSettings' = maybe id (setHost . fromString) (develHost opts) defaultSettings
runProxyTls port app = do runProxyTls port app = do
let certDef = $(embedFile "certificate.pem") let certDef = $(embedFile "certificate.pem")
keyDef = $(embedFile "key.pem") keyDef = $(embedFile "key.pem")
certOpts = bisequence $ (certPath &&& keyPath) opts certOpts = bisequence $ (certPath &&& keyPath) opts
theSettings = maybe (tlsSettingsMemory certDef keyDef) (uncurry tlsSettings) certOpts theSettings = maybe (tlsSettingsMemory certDef keyDef) (uncurry tlsSettings) certOpts
runTLS theSettings (setPort port defaultSettings') $ \req send -> do runTLS theSettings (setPort port defaultSettings') $ \req send -> do
let req' = req let req' = req
{ requestHeaders { requestHeaders
= ("X-Forwarded-Proto", "https") = ("X-Forwarded-Proto", "https")
-- Workaround for -- Workaround for
-- https://github.com/yesodweb/wai/issues/478, where -- https://github.com/yesodweb/wai/issues/478, where
-- the Host headers aren't set. Without this, generated -- the Host headers aren't set. Without this, generated
-- URLs from guestApproot are incorrect, see: -- URLs from guestApproot are incorrect, see:
-- https://github.com/yesodweb/yesod-scaffold/issues/114 -- https://github.com/yesodweb/yesod-scaffold/issues/114
: (case lookup "host" (requestHeaders req) of : (case lookup "host" (requestHeaders req) of
Nothing -> Nothing ->
case requestHeaderHost req of case requestHeaderHost req of
Just host -> (("Host", host):) Just host -> (("Host", host):)
Nothing -> id Nothing -> id
Just _ -> id) Just _ -> id)
(requestHeaders req) (requestHeaders req)
} }
app req' send app req' send
httpProxy = runSettings (setPort (develPort opts) defaultSettings') proxyApp httpProxy = runSettings (setPort (develPort opts) defaultSettings') proxyApp
httpsProxy = runProxyTls (develTlsPort opts) proxyApp httpsProxy = runProxyTls (develTlsPort opts) proxyApp
say "Application can be accessed at:\n" say "Application can be accessed at:\n"