即使请求来自使用HTTPS的页面,我的AJAX请求也在使用HTTP.知道为什么它降级到HTTP?
这是我的AJAX请求:
$(function() {
// Update section options whne course is changed
$('#id_new_course').change(function() {
// Get selected coursenum
var val = $(this).val();
var sect_input = $('#id_section');
// Disable #id_section when no course is selected
if (val == '') {
sect_input.empty();
sect_input.prop('disabled', true);
} else {
// Get list of sections for selected course and update #id_section options
$.ajax({
url: '/account/support_dashboard.get_course_sections/' + val + '/',
dataType: 'json',
success: function(data) {
// Empty options and add new ones to #id_section
sect_input.empty();
$.each(data, function(value, key) {
sect_input.append($('<option></option>').attr('value', value).text(key));
});
sect_input.prop('disabled', false);
},
error: function() {
console.log('ERROR OCCURRED TRY AGAIN');
}
});//ajax
}//if
});
}); //ready
Run Code Online (Sandbox Code Playgroud)
这是我的Web控制台中的错误输出:
Mixed Content: The page at 'https://www.myeducator.com/account/support_dashboard/1027/993532704604577793/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.myeducator.com/account/support_dashboard.get_course_sections/915ba/'. This request has been blocked; the content must be served over HTTPS.
Run Code Online (Sandbox Code Playgroud)
javascript文件正在通过HTTPS加载:

此外,实际的ajax请求将以HTTPS的形式出现:

我也不认为它与我的Web服务器(nginx)有任何关系.我只有一个重写命令,使用相同的请求方案将任何未处理的子域重定向到www.myeducator.com:
server {
listen 443 default_server ssl;
server_name _;
...
# the rewrite string
rewrite ^ $scheme://www.myeducator.com$request_uri redirect;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2424 次 |
| 最近记录: |