1

由于此请求已被阻止,我无法通过我的浏览器获得预期结果;内容必须通过 HTTPS 提供。

我试过添加这个

{% block head %}
{{super()}}
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
{% endblock %}

这对其他人有用

'https://matic.herokuapp.com/' was loaded over HTTPS, but requested an
insecure XMLHttpRequest endpoint
'http://matic.herokuapp.com/status/9092ba37-591e-4e73-b9e3-0ad9bef26cb1'.
This request has been blocked; the content must be served over HTTPS.
4

1 回答 1

1

这意味着您正在动态生成 http url 而不是 https。当我查看您的代码时,您正在使用

return jsonify(
       {}), 202, {
       'Location': url_for(
            'taskstatus', task_id=task.id)}`

创建动态网址。你能把这个更新为

return jsonify(
       {}), 202, {
       'Location': url_for(
           'taskstatus', task_id=task.id, _external=True, _scheme='https')}`

并以结果回应。不是区别url_for

于 2019-11-05T10:16:56.963 回答