gpt4 book ai didi

http - 我可以在 nginx upstream 中同时使用 HTTP 和 HTTPS 吗?

转载 作者:可可西里 更新时间:2023-11-01 17:17:27 25 4
gpt4 key购买 nike

我的 Nginx 配置如下:

upstream staging {
server myappstaging.somedomain.com;
}

upstream prod {
server myapp.somedomain.com:443;
}

# map to different upstream backends based on header
map $http_x_server_select $pool {
default "prod";
staging "staging";
}

server {
listen 80;
server_name myapp.mydomain.com;

location / {
proxy_pass https://$pool;
}
}

我想将 x-server-select header 设置为暂存到 http://myappstaging.somedomain.com 并将产品转发到 https ://myapp.somedomain.com:443

Nginx 可以吗?

最佳答案

将方案作为变量的一部分。

例如:

map $http_x_server_select $pool {
default "https://prod";
staging "http://staging";
}

和:

proxy_pass $pool;

关于http - 我可以在 nginx upstream 中同时使用 HTTP 和 HTTPS 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54733744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com