Nginx:通过SSL代理隧道

时间:2020-05-14 17:08:50

标签: ssl nginx

我有一个客户端设备A需要与服务器C通信。 达到此目的的唯一方法是通过Nginx服务器B。

我想在A和C之间通过B建立一个https隧道。我知道nginx支持使用以下模块进行隧道:https://github.com/chobits/ngx_http_proxy_connect_module 但是,当服务器B侦听ssl连接时,我没有让它正常工作。

这可行,但是我希望A和B之间建立ssl连接:

server {
    listen 8000;

    proxy_connect;
    proxy_connect_allow            all;
    proxy_connect_connect_timeout  10s;
    proxy_connect_read_timeout     10s;
    proxy_connect_send_timeout     10s;

}

这失败了:

server {
    listen 8000 ssl default_server;
    ssl_certificate        /usr/share/certs/server.crt;
    ssl_certificate_key    /usr/share/certs/server.key;        


    # forward proxy for CONNECT request
    proxy_connect;
    proxy_connect_allow            all;
    proxy_connect_connect_timeout  10s;
    proxy_connect_read_timeout     10s;
    proxy_connect_send_timeout     10s;

}

我收到以下错误: “客户端在读取客户端请求标头时向HTTPS端口发送了纯HTTP请求”,但我的代理服务器似乎已正确配置:

System.setProperty("https.proxyHost", "192.168.0.183");
System.setProperty("https.proxyPort", "8000");

我知道嵌套ssl连接在技术上是可行的,但到目前为止我还没有运气。我有什么想念吗?

谢谢!

0 个答案:

没有答案