Doccano: 始终通过 http 完成的 XHR 请求会导致混合内容问题

创建于 2019-08-05  ·  3评论  ·  资料来源: doccano/doccano

我通过https内部提供 doccano 服务。 当我过去通过http提供它时,一切正常,但是当我切换到https并尝试注释新的数据页面时,我在控制台中收到此错误。
似乎 xhr 请求总是通过 http 发出,因此默认情况下会阻止内容。
您能否确保代码可以与两种协议一起使用?

document_classification.js:1 Mixed Content: The page at 'https://doccano.example.com/projects/4/#' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://doccano.example.com/v1/projects/4/docs?doc_annotations__isnull=&limit=5&offset=5&q='. This request has been blocked; the content must be served over HTTPS.
(anonymous) @ document_classification.js:1
e.exports @ document_classification.js:1
e.exports @ document_classification.js:1
Promise.then (async)
s.request @ document_classification.js:1
s.<computed> @ document_classification.js:1
(anonymous) @ document_classification.js:1
search @ document_classification.js:8
nextPage @ document_classification.js:8
t @ document_classification.js:14
Pr.t._withTask.o._withTask @ document_classification.js:14
document_classification.js:1 Uncaught (in promise) Error: Network Error
    at e.exports (document_classification.js:1)
    at XMLHttpRequest.d.onerror (document_classification.js:1)
question

最有用的评论

@armanrahman22@fnocera正在处理实现我上面提到的第二种方法的拉取请求。 修复程序应该很快就准备好了。

所有3条评论

看起来导致问题的提取是 Django Rest Framework 分页链接,并且 Django 服务器不知道它托管在 HTTPS 之后。 您可能必须设置SECURE_PROXY_SSL_HEADER才能让客户端 https 使用分页(配置更改)。

或者,也可以对我们在 Vue 中从 DRF 分页接收到的 URL 进行后处理,并始终使用前端源发出请求,而不是链接中指定的显式源(代码更改)。

@armanrahman22@fnocera正在处理实现我上面提到的第二种方法的拉取请求。 修复程序应该很快就准备好了。

https://github.com/chakki-works/doccano/pull/328修复了混合内容问题。

此页面是否有帮助?
0 / 5 - 0 等级