gpt4 book ai didi

ssl - 我怎样才能告诉 Varnish 发送 https 给主人?

转载 作者:太空宇宙 更新时间:2023-11-03 13:12:49 25 4
gpt4 key购买 nike

我有几个 NGINX 服务器在负载均衡器后面运行。

我如何告诉 Varnish 通过 https 将任何域上的所有传入请求发送到 10.x.x.x:443 (master_ip:443)?我们在中央系统上处理大量网站,因此需要某种模式。

最佳答案

尝试将此重定向作为起点并自定义您的多站点设置:

sub vcl_recv {
if ( (req.http.host ~ "^(?i)somesite.org" || req.http.host ~ "^(?i)www.somesite.org")
&& req.http.X-Forwarded-Proto !~ "(?i)https") {
set req.http.x-Redir-Url = "https://www.somesite.org" + req.url;
error 750 req.http.x-Redir-Url;
}
}

sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = obj.response;
set obj.status = 302;
return (deliver);
}

引用自this link :

Useful when you want to redirect the clients to an SSL-version of your site, given that your varnish instance is running behind some SSL-termination point, such as a nginx instance with SSL enabled.

关于ssl - 我怎样才能告诉 Varnish 发送 https 给主人?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19075997/

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