Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ACMEValidationMiddleware ¶ added in v0.0.4
ACMEValidationMiddleware implements the HTTP01 based redirect protocol specific to heroku ACM.
func CORS ¶
CORS adds Cross-Origin Resource Sharing headers to all outgoing requests. This is known as something that is kind of hard to get right. See docs at https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS for more information.
Example ¶
r := chi.NewRouter() r.Use(CORS) // OR var h http.Handler if err := http.ListenAndServe(":"+os.Getenv("PORT"), CORS(h)); err != nil { log.Fatal(err) }
Output:
func DisableKeepalive ¶
DisableKeepalive instructs the Go HTTP stack to close the incoming HTTP connection once all requests processed by this middleware are complete.
Example ¶
r := chi.NewRouter() r.Use(DisableKeepalive) // OR var h http.Handler if err := http.ListenAndServe(":"+os.Getenv("PORT"), DisableKeepalive(h)); err != nil { log.Fatal(err) }
Output:
func EnsureTLS ¶
EnsureTLS ensures all incoming requests identify as having been proxied via https from the upstream reverse proxy. The way that this uses to check relies on the `X-Forwarded-Proto` header which is not defined by any formal standard. For more information on this header, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto.
Example ¶
r := chi.NewRouter() r.Use(EnsureTLS) // OR var h http.Handler if err := http.ListenAndServe(":"+os.Getenv("PORT"), EnsureTLS(h)); err != nil { log.Fatal(err) }
Output:
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package httpmetrics provides an http.Handler for collecting metrics about http servers.
|
Package httpmetrics provides an http.Handler for collecting metrics about http servers. |