gpt4 book ai didi

apache - 使用 .htaccess 将 http 重定向到 https - 使用 let-proxy 导致 ERR_TOO_MANY_REDIRECTS

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

我使用了一项名为lets-proxy2 (https://github.com/rekby/lets-proxy2) 的服务来自动从Let's Encrypt 获取和更新证书。
这很好用,但是当尝试在 .htaccess 文件中将 http 重定向到 https 时,我得到一个无限重定向循环,它在浏览器中抛出错误 ERR_TOO_MANY_REDIRECTS。
我尝试了几种不同的 RewriteConds 和 RewriteRules,我都遇到了同样的问题。
我正在使用的当前 .htaccess 文件是:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP:X-FORWARDED-PROTO} !(^.+)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
我需要强制使用 https 以确保所有 http 流量都重定向到 https,但是目前尝试使用 .htaccess 文件将无法正常工作。
任何帮助,将不胜感激。

最佳答案

lets-proxy2 的作者实际上已经发布了一个修复程序来解决这里的问题 - https://github.com/rekby/lets-proxy2/issues/140 .
没有设置默认标题,所以它只是以无限循环结束。

关于apache - 使用 .htaccess 将 http 重定向到 https - 使用 let-proxy 导致 ERR_TOO_MANY_REDIRECTS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62997086/

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