php - 在 HTTPS 请求中呈现 HTTP

标签 php apache http https

我已经使用 Graphite 安装了 Icinga 2 监控工具支持。
Graphite 基本上提供基于 Icinga 2 生成的指标的图表。

它通过 HTTP 工作,但每当我为我的 Apache VHOST 启用 HTTPS 时,它就会停止工作。

以下链接是所请求内容的示例。

https://monitoring.example.com/icingaweb2/graphite?graphite_url= http%253A%252F%252Fgraphite.example.com%252Frender%252F%253F%2526target%253Dicinga2.hostname.services.ping6.ping6.perfdata.rta.value%2526source%253D0%2526width%253D600 %2526height%253D400%2526colorList%253D049BAF%2526lineMode%253Dconnected

<VirtualHost *:80>
    ServerName monitoring.example.com

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://monitoring.example.com/icingaweb2

    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

<VirtualHost *:443>
    ServerName monitoring.example.com

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/ssl/certs/monitoring.example.com.crt
    SSLCertificateKeyFile /etc/ssl/certs/monitoring.example.com.key
    SSLCACertificateFile /etc/ssl/certs/GeoTrust_CA_Bundle.crt

    SetEnvIf User-Agent ".*MSIE.*" \
             nokeepalive ssl-unclean-shutdown \
             downgrade-1.0 force-response-1.0

    Alias "/icingaweb2" "/usr/share/icingaweb2/public"

    <Directory "/usr/share/icingaweb2/public">
        Options SymLinksIfOwnerMatch
        AllowOverride None

        Order allow,deny
        Allow from all

        SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2"

        EnableSendfile Off

        <IfModule mod_rewrite.c>
            RewriteEngine on
            RewriteBase /icingaweb2/
            RewriteCond %{REQUEST_FILENAME} -s [OR]
            RewriteCond %{REQUEST_FILENAME} -l [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^.*$ - [NC,L]
            RewriteRule ^.*$ index.php [NC,L]
        </IfModule>

        <IfModule !mod_rewrite.c>
            DirectoryIndex error_norewrite.html
            ErrorDocument 404 /error_norewrite.html
        </IfModule>
    </Directory>           
</VirtualHost>

我已经为虚拟主机启用了“LogLevel debug”,但没有任何错误。 HTTP 响应代码始终等于 200。

URL 由以下 PHP 代码段编码:

$url = Url::fromPath('graphite', array(
            'graphite_url' => urlencode($largeImgUrl)
        ));

请给我一个可能发生的事情的提示。

最佳答案

看起来不可能混合使用 HTTP 和 HTTPS。配置 graphite.example.com 以通过 HTTPS 工作解决了这个问题。

Google Chrome 控制台说:

Mixed Content: The page at 'https://monitoring.example.com/icingaweb2/monitoring/service/show?host=c…600%2526height%253D400%2526colorList%253D049BAF%2526lineMode%253Dconnected' was loaded over HTTPS, but requested an insecure image 'http://graphite.example.com/render/?&target=icinga2.camhpcvm02.services.…ht=120&hideAxes=true&lineWidth=2&hideLegend=true&colorList=049BAF&from=-1h'. This content should also be served over HTTPS. show?host=camhpcvm02&service=ssh:1

关于php - 在 HTTPS 请求中呈现 HTTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34117707/

相关文章:

php - MySql如何在1个查询中选择具有2个不同where条件的总和列

php - 通过大学代理从本地 LAMP 连接到远程 MySQL 数据库

php - 在多边形 PHP 中查找点

linux - 将包含路径值添加到 .htaccess 会导致内部服务器错误

java - 如何发送参数值包含空格的 GET 请求?

javascript - iframe 滚动问题.. 解决方法是什么?

AuthnProviderAlias ldap 可以与 Apache2.4.x 一起使用吗?

java - 随机未正确创建证书

python - 发送 JSON 字符串作为 post 请求

android - 如何让我的应用程序向桌面程序发送消息?