迁移到AWS - Https重定向问题(Drupal)

时间:2017-12-13 10:30:45

标签: amazon-web-services amazon-ec2 drupal

我在AWS上设置了SSL认证。

然而,这似乎是自动重定向到https而不是点击我们的vhosts文件..

页面错误输出以下内容......

mixed Content: The page at 'https://preprod-example.co.uk/' was loaded over HTTPS, but requested an insecure stylesheet 'http://preprod-example.co.uk/modules/system/system.base.css?ow428z'. This request has been blocked; the content must be served over HTTPS.

vhosts文件:

<VirtualHost *:80>

    DocumentRoot "/var/www/html/example/production"
    ServerName preprod-example.co.uk

    <Directory /var/www/html/example/production>
           order allow,deny
           allow from all
            AllowOverride all
    </Directory>

</VirtualHost>

<VirtualHost *:443>

    DocumentRoot "/var/www/html/example/production"
    ServerName preprod-example.co.uk

    <Directory /var/www/html/example/production>
           order allow,deny
           allow from all
            AllowOverride all
    </Directory>

</VirtualHost>

我哪里出错或者这可能是AWS的问题?

1 个答案:

答案 0 :(得分:1)

  

SetEnvIf X-Forwarded-Proto&#34; ^ https $&#34; HTTPS =上

您可以在443虚拟主机之前使用SetEnvif

<VirtualHost *:80>    
DocumentRoot "/var/www/html/example/production"
    ServerName preprod-example.co.uk

    <Directory /var/www/html/example/production>
           order allow,deny
           allow from all
            AllowOverride all
    </Directory>

</VirtualHost>

    SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
<VirtualHost *:443>

    DocumentRoot "/var/www/html/example/production"
    ServerName preprod-example.co.uk

    <Directory /var/www/html/example/production>
           order allow,deny
           allow from all
            AllowOverride all
    </Directory>

</VirtualHost>
相关问题