HTTPS Ajax请求生成HTTP响应-混合内​​容错误(Bitnami Redmine)

时间:2019-07-04 11:02:32

标签: jquery ajax apache https

我在Bitnami实例Windows Server 2019上将Redmine 3.4与jQuery 1.11.1结合使用。它已按照this指南配置为在端口443上运行,因此我强制将所有http连接重定向到https 。然后,我安装了this plugin,它会进行一系列$ .ajax()调用。

当请求URL作为https请求传递时,响应标头指示一个http位置,这给了我错误:

Mixed Content: The page at 'https://../issues/7501?issue_count=11&issue_position=1&next_issue_id=6028' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://../issues/7501?issue_count=11&issue_position=1&next_issue_id=6028'. This request has been blocked; the content must be served over HTTPS. -------- Error while updating the issue attribute dynamically -------- issue_dynamic_edit.js?1562175326:389 xhr data: ...

我编辑了Ajax请求,如下所示:

type: 'POST',
    url: 'https://' + (
        typeof custom_location_href !== 'undefined' 
        ? custom_location_href.split('://')[1]  
        : window.location.href.split('://')[1] 
    ) + '/',
    data: formData

POST请求的响应标头如下所示:

Location | http://website…sue_id=4204&prev_issue_id=5667

apps \ redmine \ comnf \ httpd-vhosts.conf如下:

<VirtualHost *:80>
    ServerName websiteurl.com
    ServerAlias www.websiteurl.com
    Redirect  permanent / https://websiteurl.com
</VirtualHost>

<VirtualHost *:443>
    ServerName websiteurl.com
    ServerAlias www.websiteurl.com
    DocumentRoot "C:/Bitnami/redmine-3.4.6-5/apps/redmine/htdocs/public"
    SSLEngine on
    SSLCertificateFile "C:/Bitnami/redmine-3.4.6-5/apps/redmine/conf/certs/name.wildcard.crt"
    SSLCertificateChainFile "C:/Bitnami/redmine-3.4.6-5/apps/redmine/conf/certs/gd_bundle-g2-g1.crt"
    SSLCertificateKeyFile "C:/Bitnami/redmine-3.4.6-5/apps/redmine/conf/certs/name.wildcard.key"

    RequestHeader set X_FORWARDED_PROTO 'https'

    <Directory "C:/Bitnami/redmine-3.4.6-5/apps/redmine/htdocs/public">
    Options -MultiViews
    allow from all      
</Directory>

RewriteEngine On
RewriteRule ^/(.*)$ balancer://redminecluster%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://redminecluster>
    BalancerMember http://127.0.0.1:3001
    BalancerMember http://127.0.0.1:3002
</Proxy>

Include "C:/Bitnami/redmine-3.4.6-5/apps/redmine/conf/httpd-app.conf"
</VirtualHost>

原因可能是什么?瘦服务器会导致此问题吗?我尝试通过将.htaccess文件设置到公用文件夹来进行尝试,但这没有帮助。

.htaccess:

#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

在此先感谢您的帮助。

0 个答案:

没有答案