在 node.js 0.8 下,我在“路由器表”模式下使用 node-http-proxy,配置如下:
var httpProxy = require("http-proxy");
var config = require("./config");
proxyServer = httpProxy.createServer({
hostnameOnly: true,
router: {
"one.example.com": "localhost:9000",
"two.example.com": "localhost:9001"
},
https: {
key: config.key,
cert: config.cert,
// mitigate BEAST: https://community.qualys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls
honorCipherOrder: true,
ciphers: "ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH"
}
})
proxyServer.listen(8000)
我想添加HSTS(HTTP 严格传输安全),以便兼容的浏览器被告知始终使用 SSL。为此,我需要获取 http-proxy 以添加标头:
Strict-Transport-Security: max-age=60000
(或其他最大年龄)。如何让 node-http-proxy 有效地附加此标头?