Skip to content

Instantly share code, notes, and snippets.

@niw
Last active May 18, 2020 05:34
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 niw/4fc5d845aa0b290a369fd6aee03d7347 to your computer and use it in GitHub Desktop.
Save niw/4fc5d845aa0b290a369fd6aee03d7347 to your computer and use it in GitHub Desktop.
`netlify-cli` knwon issues

netlify-cli known issues

A memo about netlify-cli. Too lazy to file issues or create pull requests for now.

Headers

Looks like it has no ability to read headers in netlify.toml and only supports _headers. Also, in _headers, it can't override headers set by root web server such as content-type.

This is not same behavior as Netlify service and probably netlify-cli implementation issue.

// In `src/commands/dev/index.js`
const pathHeaderRules = objectForPath(headerRules, requestURL.pathname)
if (!isEmpty(pathHeaderRules)) {
  Object.entries(pathHeaderRules).forEach(([key, val]) => res.setHeader(key, val))
}
res.writeHead(req.proxyOptions.status || proxyRes.statusCode, proxyRes.headers)

It calls writeHead with proxyRes.headers, which takes a precedent than headers set by setHeader in res.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment