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

Make NGINX verify upstream SSL certificate against a custom domain?

· 52CE 我爱测

I have a custom-managed domain when inside my corporate's intranet it resolves to an internal gateway machine, and when outside the intranet it resolves to Cloudflare. There's a website we want to provide access to both the intra…

问题原文

原帖链接 · iBug · CC BY-SA 4.0

I have a custom-managed domain when inside my corporate's intranet it resolves to an internal gateway machine, and when outside the intranet it resolves to Cloudflare. There's a website we want to provide access to both the intranet and the internet, so I have configured Nginx on the gateway as follows:

server {
    listen 443 ssl http2;
    server_name example.com;

    location / {
        proxy_pass https://example.com.cloudflare.net;
        proxy_set_header Host "example.com";
    }
}

The problem is, now I want Nginx to verify the SSL certificate for example.com.cloudflare.net against example.com (instead of the resolved domain). How should I do so?

Note that example.com resolves to the intranet IP address of this gateway machine (it's in the intranet, too).

已采纳解答

原帖链接 · Steffen Ullrich · CC BY-SA 4.0

Looks like proxy_ssl_name is what you are looking for. From the documentation:

Syntax:   proxy_ssl_name name; 
Default:  proxy_ssl_name $proxy_host;
...
Allows overriding the server name used to verify the certificate 
proxied HTTPS server and to be passed through SNI when establishing
a connection with the proxied HTTPS server.

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

资料来源与适用范围

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

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

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