Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

浏览器插件不能使用http,只能用https #400

Closed
terwer opened this issue Feb 25, 2023 · 1 comment
Closed

浏览器插件不能使用http,只能用https #400

terwer opened this issue Feb 25, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@terwer
Copy link
Owner

terwer commented Feb 25, 2023

关于http和https的问题

  1. 网页端由于要走代理,为了安全代理地址默认是使用https,http会直接返回失败。而直接在思源内部,没有这个限制,http和https都行

  2. 思源笔记内部没这个问题,是因为 cross-fetch 检测到服务器支持https之后,发现请求却是http,然后做了一次自动转发,将http转发为https

  3. 测试的http没问题,是因为如果服务器不支持https,请求不会转发。

  4. 走代理有问题是因为,请求代理这边,我默认不会进行请求转发,所以http请求返回之后直接返回,不会去管是否转发到https。这个下版本会优化

Image

Image

参考:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307

@terwer
Copy link
Owner Author

terwer commented Feb 25, 2023

可能的修复方案:

方案一:浏览器插件页面给出提示,提示用户使用https

方案二:浏览器插件的调用,修改请求代理的处理逻辑。

如果服务器支持https,但是请求写的是http自动转发到https。
如果服务器不支持https,但是请求写的是http自动,仍然使用http。

简单的说,就是处理一下 307 重定向。遇到 307 进行请求重发。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 已完成
Development

No branches or pull requests

1 participant