gpt4 book ai didi

load-balancing - Google HTTP 负载平衡强制执行 HTTPS

转载 作者:行者123 更新时间:2023-12-04 04:27:15 25 4
gpt4 key购买 nike

我在 Google Cloud 上有一个 HTTP 和 HTTPS 负载平衡器。是否可以将其设置为强制(重定向)到 HTTPS 的所有连接?

最佳答案

截至 2015 年 6 月,不在负载均衡器上。

作为替代方案,您可以将 Web 服务器配置为针对所有重定向到 HTTPS 版本的 HTTP 请求返回 301。

对于 Apache(来自 https://wiki.apache.org/httpd/RedirectSSL):

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://www.example.com/
</VirtualHost>

<VirtualHost _default_:443>
ServerName www.example.com
DocumentRoot /my/document/root
SSLEngine On
# .. etc .
</VirtualHost>

对于 nginx(来自 https://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom):
server {
listen [::]:80;
return 301 https://$host$request_uri;
}

关于load-balancing - Google HTTP 负载平衡强制执行 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30843895/

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