Skip to content

Instantly share code, notes, and snippets.

@abedra
Created July 3, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abedra/adc373bde201e20088210938d7ef6dcd to your computer and use it in GitHub Desktop.
Save abedra/adc373bde201e20088210938d7ef6dcd to your computer and use it in GitHub Desktop.
ocaml / mirageos unikernel webserver secure headers
let add_headers (path: string): Cohttp.Header.t =
Cohttp.Header.add_list (Cohttp.Header.init ()) [
("Strict-Transport-Security", "max-age=31536000; includeSubdomains; preload");
("Content-Type", (Magic_mime.lookup path));
("X-XSS-Protection", "1; mode=block");
("X-Frame-Options", "DENY");
("X-Content-Type-Options", "nosniff")
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment