Disable SSL certificate validation in Haskell `req` library

365 Views Asked by At

How to disable SSL certificate validation when using the Haskell req library? Similar to curl -k.

1

There are 1 best solutions below

1
Sridhar Ratnakumar On BEST ANSWER
import Network.Connection (TLSSettings (TLSSettingsSimple))
import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (mkManagerSettings)
import Network.HTTP.Req

main = do
  myManager <- newManager $ mkManagerSettings (TLSSettingsSimple True False False) Nothing
  let httpConfig = def { httpConfigAltManager = Just myManager }
  runReq httpConfig $ do
    req POST -- ...