内网一台服务器10.1.1.1,DMZ区域一台配置了nginx的服务器59.1.1.1,目前该nginx服务器已经配置了反向代理10.1.1.1的tomcat服务,是通过https://域名来访问的时候代理内网服务的,已经实现反向代理来访问10.1.1.1了。
那么现在我这台10.1.1.1的内网服务器,又需要访问外网的一个https域名,我按照百度到的配置,在这台nginx.conf配置文件最后面增加了:
server {
resolver 114.114.114.114;
listen 443;
location / {
proxy_pass https://$host$request_uri;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}
然后重启服务。 现在内网10.1.1.1上测试访问https,发现不行,如下:
HTTP/1.1 400 Bad Request
Server: nginx/1.21.6
Date: Thu, 07 Jul 2022 07:26:17 GMT
Content-Type: text/html
Content-Length: 255
Connection: close
请问是什么原因,是配置 问题还是 不能在同一个服务器上同时正向反向代理https