【发布时间】:2016-07-04 14:31:05
【问题描述】:
在站点 example.com 上,我在 .htaccess 中强制使用 https
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
供应商应该将数据发布到 https://www.example.com/membership/foobar.php,并且他们坚持使用 https 方案发布信息。
在日志中查找他们的 IP 总是遵循这种模式:
[17/Mar/2016:00:15:11 -0400] "POST /membership/foobar.php HTTP/1.1" 302 1165 731 "-" "-"
[17/Mar/2016:00:15:11 -0400] "GET /membership/foobar.php HTTP/1.1" 200 743 2623 "-" "-"
[17/Mar/2016:17:37:58 -0400] "POST /membership/foobar.php HTTP/1.1" 302 1179 731 "-" "-"
[17/Mar/2016:17:37:58 -0400] "GET /membership/foobar.php HTTP/1.1" 200 743 2623 "-" "-"
当我读到这篇文章时,它是一个接收 302 然后被解释为 GET 的 POST,我认为这是由于 htaccess 重写了对 http 方案的请求,而不是 https。
这是正确的解释吗?
【问题讨论】:
-
我想是的,是的。他们通过 POST http:// 页面请求并被重定向,GET 可能是因为您的 .htaccess,或者如果在您的 PHP 代码中执行了类似 header() 的操作。在您的 .htaccess 中尝试 [R=301,L] , 表示这是一个永久重定向。