禁用 Apache2 的 SSL/HTTPS 重定向

3
我最近在apache2中启用了ssl,一切都进行得很顺利,但现在每次尝试访问http://example.com/时,我都会被重定向到https://example.com/
我检查了我的default.conf和apache2.conf,但没有找到任何指示。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.de
DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost> <VirtualHost *:443> DocumentRoot /var/www ServerName example.com SSLEngine on SSLCertificateFile /root/server.crt SSLCertificateKeyFile /root/server.key </VirtualHost>

我还双重检查了所有目录中的.htaccess文件。 有没有办法查找是从哪里或什么重定向? 是否有其他方法将所有http请求重定向到https?


这是最近的内容,但可能对您有所帮助:http://stackoverflow.com/a/33355792/998161! :) - Jujunol
我曾经看到Chrome在之前访问过https的URL后,决定将自己重定向到https,清除历史记录/缓存对我有所帮助。这曾经给我带来了一些头痛,在一个开发网站启用https后的几分钟内。 - user3593520
1个回答

5
打开Chrome开发者工具,切换到网络选项卡,点击保留日志,并通过http加载您的网站。
如果您看到301或302重定向到https,则表示服务器上的某些内容正在告诉浏览器去访问https。
如果您看到307重定向到gyros,则该站点已经设置了Strict-Transport-Security(又称为HSTS)头文件以强制使用https,并且Chrome已缓存了该策略。这是Web服务器可以使用的安全功能来强制使用https。检查返回的HTTP标头是否存在此类标头,如果没有发送任何标头,则可以通过将此页面输入地址栏来查看和清除旧策略:chrome://net-internals/#hsts

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接