gpt4 book ai didi

node.js - 接受 SSL 流量的 Node http 代理端口号

转载 作者:太空宇宙 更新时间:2023-11-03 14:47:13 26 4
gpt4 key购买 nike

以下示例取自node-http-proxy的github页面

HTTPS -> HTTP

//
// Create the HTTPS proxy server in front of a HTTP server
//
httpProxy.createServer({
target: {
host: 'localhost',
port: 9009
},
ssl: {
key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
}
}).listen(8009);


问题:为什么 httpProxy 不监听端口 443 以获取安全的 SSL 流量?

最佳答案

SSL 的默认端口为 443,但与同样具有默认 80 端口的常规 HTTP 协议(protocol)一样,它可以绑定(bind)到自定义端口并通过在 url 中指定端口(https://localhost:8009)进行访问。基于this answer .

关于node.js - 接受 SSL 流量的 Node http 代理端口号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37960333/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com