4

我有一个在 nginx 和 php-fpm 上运行的 drupal 站点,并在多个服务器之间实现了 haproxy 平衡。

我为 haproxy 设置了两个服务:http 和 https。

如果我去http://subdomain.domain.com,它工作正常。
如果我去https://subdomain.domain.com,它也可以正常工作。如果我然后返回 http,它现在会重定向到 https。这发生在 Firefox 和 chrome 中,但不在 IE 中。

如果知道它存在,是否有一些设置会自动重定向到 https?也许如果设置了安全标头?

我尝试查看 LiveHTTPHeaders,但此时它仅显示 https 部分。
我尝试在 Chrome 中查找,它说:

t=1312233405229 [st=  0] +REQUEST_ALIVE                             [dt=192]
t=1312233405229 [st=  0]     URL_REQUEST_START_JOB                  [dt=  0]
                             --> load_flags = 1114241 (ENABLE_LOAD_TIMING | MAIN_FRAME | VALIDATE_CACHE | VERIFY_EV_CERT)
                             --> method = "GET"                   
                             --> priority = 0                     
                             --> url = "http://subdomain.domain.com/"   
t=1312233405229 [st=  0]    +URL_REQUEST_START_JOB                  [dt=  0]
                             --> load_flags = 1114241 (ENABLE_LOAD_TIMING | MAIN_FRAME | VALIDATE_CACHE | VERIFY_EV_CERT)
                             --> method = "GET"                   
                             --> priority = 0                     
                             --> url = "http://subdomain.domain.com/"   
t=1312233405229 [st=  0]        URL_REQUEST_REDIRECTED              
                                --> location = "https://subdomain.domain.com/"

它似乎在进行重定向,但没有说明原因。

我尝试使用 Wireshark 进行嗅探,但无法理解它,因为我无法让 SSL 解密工作(我有密钥)。

4

1 回答 1

5

我已经想通了。我在 nginx 中有一个设置: add_header Strict-Transport-Security "max-age=7200"; 这是 chrome 和 firefox 4 支持的新功能:chromium.org/sts

于 2012-02-09T22:27:54.953 回答