i have this code to start a snap app over https:
main :: IO ()
main = do
-- get the port from the ENV , it should be in /etc/profile as any other ENV variable or $ export BIND_PORT=8000
a <- lookupEnv "BIND_PORT"
let port = displayResult a
liftIO $ createDirectoryIfMissing True "img"
httpServe (setPort (read port) config) Main.skite
where
config =
setSSLPort 443 $
setSSLCert "/etc/letsencrypt/../cert.pem" $
setSSLKey "/etc/letsencrypt/../privkey.pem" $
setSSLBind "0.0.0.0" $
setSSLChainCert False $
defaultConfig
skite :: Snap ()
skite = do
req <- fmap rqHostName getRequest
reqPath <- fmap rqPathInfo getRequest
routes req reqPath
where
routes req reqPath =
Rain.skite
Now, when i am browsing with example.com
is not forwarded to https://example.com
. Is there any builtin functionality to do this?