且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Docker ngix/traefik 301 将 http 重定向到 localhost 中的 https

更新时间:2022-03-17 03:08:07

经过 OP 的更多测试和其他用户的评论:似乎在 Nginx 处理请求后发生了重定向(HTTP 到 HTTPS).

After more tests from OP, and other user's comments: it seemed that the redirection (HTTP to HTTPS) was occurring after Nginx handled the request.

OP 还使用单个 index.html 文件进行了测试,并且没有重定向到 HTTPS:确认重定向来自 PHP(或至少不是来自 Nginx).

OP also tested using a single index.html file and was not redirected to HTTPS: confirming that the redirection came from PHP (or at least not from Nginx).

接下来的步骤是研究 Drupal 配置和/或 htaccess 配置.OP 更改了一些 Drupal 配置(关于重定向),并成功使 Drupal 设置页面仅使用 HTTP.

The next steps were to look into Drupal configuration, and/or htaccess configuration. OP changed some Drupal configuration (about redirections), and successfully got the drupal setup page working with HTTP only.

在这种情况下,***始终尝试找出问题的来源:

Best in those case is always to try to pin-point the where the issue come from:

  • 使您的 Nginx 配置最小化:简单的 index.html
  • 定期清除浏览器缓存:他们有时会缓存重定向
  • 检查/删除 htaccess 以查看行为是否发生变化
  • 最后,如果 Nginx 是干净的"来自任何问题,而 htaccess 似乎不是问题:它主要是之后",所以问题可能来自Nginx 向谁发送请求"
  • 来自大"框架/CMS,如 Drupal、Woocommerce、Laravel……重定向通常容易"处理;来自配置文件或数据库设置.
  • 当您有自定义代码处理重定向时:需要调试