对于将nginx配置为将在自定义端口上接收的HTTPS流量转发到目的地url的相同自定义端口号,我有疑问。下面是我的案例。
下面给出了我使用的一个示例nginx配置:
server {
listen 8000;
server_name myserver.com;
ssl on;
ssl_certificate /path/to/server/cert;
ssl_certificate_key /path/to/server/key;
ssl_client_certificate /path/to/client/cert;
ssl_verify_client on;
#https requests to this URI gets redirected to port 443 by default
location /customUri1 {
# switch off logging
access_log off;
proxy_pass http://app-instance-ip:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
server {
listen 443;
server_name myserver.com;
ssl on;
ssl_certificate /path/to/server/cert;
ssl_certificate_key /path/to/server/key;
location /customUri2 {
# switch off logging
access_log off;
proxy_pass http://app-instance-ip:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http;
}
}
是否有任何nginx配置机制允许我将HTTPS请求发送到应用实例上的自定义端口?谢谢。
发布于 2016-04-11 00:48:13
我发现了问题。这与我将HTTPS数据包发送到服务器的方式有关。在我的Groovy代码中,HTTPBuilder的uri.port字段设置为443,而不是8000。将其替换为8000之后,我的客户端就可以将其发送到服务器。
https://stackoverflow.com/questions/36541971
复制