现在的请求方式:
通过nginx设置代理后没法进行请求,被代理地址是https方式的,并且需要双向认证,证书是pfx格式。
nginx配置方式一:
server {
listen 8441;
server_name localhost;
location /{
proxy_pass https://interface.chinaums.com:11444;
}
}
nginx配置方式二:
server {
listen 443 ssl;
server_name localhost;
#ssl on;
ssl_certificate ssl/bsrmyykey.crt;
ssl_certificate_key ssl/bsrmyykey.rsa;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
ssl_client_certificate ssl/client.crt; #根级证书公钥,用于验证各个二级client
ssl_verify_client on; #开启客户端证书验证
location ~ /uis-web/(.*) {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Ssl on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://xxxxxx:11444;
}
}
方式一访问直接返回502。
方式二返回:
关于这个问题处理了一天了,不知所措了,希望有大佬加 微信(15523035689)交流
这样试下 location /test/ { proxy_pass https://xxx.com/; proxy_ssl_certificate certs/client.cer; proxy_ssl_certificate_key certs/client.key; }
域名我在hosts文件加了以后域名访问不到,ip是可以访问的,但是ip ssl有问题
@Jonny-Xhl:
proxy_ssl_server_name on;
这个也加上试下
@小小高:
这样配置后访问https://www.cy-coo-mispos.com:8441/uis-web/services/TransactionService?wsdl还是访问不了。
找不到 www.cy-coo-mispos.com 的服务器 IP 地址。
server {
listen 8441 ssl;
server_name www.cy-coo-mispos.com;
#ssl on;
ssl_certificate ssl/server.crt;
ssl_certificate_key ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
ssl_client_certificate ssl/client.crt; #根级证书公钥,用于验证各个二级client
ssl_verify_client on; #开启客户端证书验证
location ~ /uis-web/(.*) {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Ssl on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://interface.chinaums.com:11444;
proxy_ssl_certificate ssl/bsrmyykey.crt;
proxy_ssl_certificate_key ssl/bsrmyykey.rsa;
proxy_ssl_server_name on;
}
}
ssl证书是与域名关联的,如果你通过 192.168.3.221 访问,浏览器会认为这是不安全的证书
希望dudu大佬能支持一下,接口给出者说他们采用的https双向认证,也给我颁发了证书,我在本地开发中携带了证书的。
希望能看一下我上面的图解释!
非常感谢@小小高给的提示,我把ssl的双向配置移除将证书添加到代理中去就可以了!
最终配置这样的:
server {
listen 8441;
server_name localhost;
#ssl on;
#ssl_certificate ssl/server.crt;
#ssl_certificate_key ssl/server.key;
#ssl_session_timeout 5m;
#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_ciphers on;
#ssl_client_certificate ssl/client.crt; #根级证书公钥,用于验证各个二级client
#ssl_verify_client on; #开启客户端证书验证
location ~ /uis-web/(.*) {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Ssl on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://interface.chinaums.com:11444;
proxy_ssl_certificate ssl/bsrmyykey.crt;
proxy_ssl_certificate_key ssl/bsrmyykey.rsa;
proxy_ssl_server_name on;
}
}