Express middleware that allows you to specify your HTTP response headers inside the
<head> of your HTML as
<meta http-equiv="..." content="..."> tags. The primary use case is static HTML, but the middleware works no matter what's actually generating the response body, so it'll also work with template engines, http proxies etc.
$ curl --dump-header - localhost:1337 HTTP/1.1 200 OK X-Powered-By: Express Content-Type: text/html; charset=utf-8 Content-Length: 98 X-Frame-Options: SAMEORIGIN Date: Sun, 27 Jul 2014 12:16:51 GMT Connection: keep-alive <html><head><meta http-equiv="X-Frame-Options" content="SAMEORIGIN"></head><body>foo</body></html>
npm install express-extractheaders
memoize: Only extract the response headers once per url. You will probably want to use this option in production as there's a performance hit to parsing all the outgoing HTML.
Only use this when you trust the downstream middleware. If you proxy to an untrusted host, it will gain the ability to set response headers on the behalf of your server.
express-extractheaders is licensed under a standard 3-clause BSD license -- see the
LICENSE file for details.