[英]Do I point nginx proxy_pass to HTTP or HTTPS for node HTTPS server?
我正在使用Nginx将子域指向node.js服务器正在侦听的其他端口。
它对于http正常工作,但是现在我需要切换到https。
这就是我现在在sites-available/default
:
server {
listen 80;
listen 443;
server_name sub.example.com;
location / {
proxy_pass http://example.com:2222;
}
}
现在,我将节点服务器切换为https,是否需要将proxy_pass
更改为https://example.com:2222
?
现在,我将节点服务器切换为https,是否需要将proxy_pass更改为https://example.com:2222 ?
简短的答案是没有。 代理不需要与传入请求使用相同的协议,但是您可能需要另一个指令
proxy_set_header X-Forwarded-Proto https;
我在搜索中找到了这个 。
事实证明,最好使用nginx处理SSL认证,并让节点运行http服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.