HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleservant-0.20.2Haskell2010

Servant.API.IsSecure

  • 1 type
  • Packageservant-0.20.2
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIsSecure.hs

| Use IsSecure whenever your request handlers need to know whether the connection to the server is secure or not. This would make the request handlers receive an argument of type IsSecure, whose value can be one of Secure (HTTPS) or NotSecure (HTTP).

Example:

Example1 expression
type API = "sensitive-data" :> IsSecure :> Get '[JSON] NationSecrets
datadata IsSecure
#

Was this request made over an SSL connection?

Note that this value will not tell you if the client originally made this request over SSL, but rather whether the current connection is SSL. The distinction lies with reverse proxies. In many cases, the client will connect to a load balancer over SSL, but connect to the WAI handler without SSL. In such a case, the handlers would get NotSecure, but from a user perspective, there is a secure connection.

Constructors

  • Secure

    the connection to the server is secure (HTTPS)

  • NotSecure

    the connection to the server is not secure (HTTP)

Instances8Eq, Ord, Read, Show, Generic, HasLink, …