大网数据广告活动
服务器运维问答

Nginx proxy based on SNI without decryption

· 52CE 我爱测

I am currently using the following (simplified) configuration to proxy http and https connections over the same port (required by aws elastic beanstalk): server { listen 777 ssl; server_name foo.com; ssl_certificate /etc/nginx/ss…

问题原文

原帖链接 · user319862 · CC BY-SA 3.0

I am currently using the following (simplified) configuration to proxy http and https connections over the same port (required by aws elastic beanstalk):

server {
    listen 777 ssl;
    server_name foo.com;
    ssl_certificate /etc/nginx/ssl/foo.crt;
    ssl_certificate_key /etc/nginx/ssl/foo;

    root /usr/share/nginx/www;
    index index.html index.htm;

    error_page 418 = @upstream;
    error_page 497 = @upstream;

    location / {
        return 418;
    }

    location @upstream {
        proxy_set_header  X-Forwarded-Proto  $scheme;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
    }
}

I want to change upstream to uwsgi and let uwsgi handle ssl because it would simplify deployment.

How can I adjust my configuration to work for SNI HTTPS and HTTP without Nginx decrypting the ssl traffic?

已采纳解答

原帖链接 · masegaloeh · CC BY-SA 3.0

NO, you can't do with Nginx. By default, Nginx is always decrypting content, so Nginx can apply request routing. Some solution that can be tried:

  • There are 3rd party module called nginx_tcp_proxy_module. I haven't tried it yet. Because that module do proxy on network layer, so it will passing request without decryption.

  • The preferred solution is use HAProxy. This tutorial suggest that you can do TCP proxy with SNI capabilities.


Sidenote

By default, Nginx always act as SSL offloading/decryption process on proxy. Here some the advantages doing SSL offloading (taken from here)

  • Improved performance
  • Better utilization of the backend servers
  • Intelligent routing
  • Certificate management
  • Security patches

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-09-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。