go-headers

Netlify's _headers file format parser.

MIT License

Stars
23
Committers
2

Header

Header format parser to match Netlify's format.

Example

/*
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block

## A path:
/templates/index.html
  # Headers for that path:
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block

/templates/index2.html
  X-Frame-Options: SAMEORIGIN

yields

{
  "/*": {
    "X-Frame-Options": [
      "DENY"
    ],
    "X-Xss-Protection": [
      "1; mode=block"
    ]
  },
  "/templates/index.html": {
    "X-Frame-Options": [
      "DENY"
    ],
    "X-Xss-Protection": [
      "1; mode=block"
    ]
  },
  "/templates/index2.html": {
    "X-Frame-Options": [
      "SAMEORIGIN"
    ]
  }
}