Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

ios safari下载进度总是0% #3

Closed
mzz2017 opened this issue May 15, 2018 · 7 comments
Closed

ios safari下载进度总是0% #3

mzz2017 opened this issue May 15, 2018 · 7 comments

Comments

@mzz2017
Copy link
Owner

mzz2017 commented May 15, 2018

查看https://caniuse.com/#search=XMLHttpRequest 发现并没有什么不妥,不知道是什么原因

@mzz2017
Copy link
Owner Author

mzz2017 commented May 15, 2018

已找到问题:
GET https://streamoc.music.tc.qq.com/F000001bqYo71oYI14.flac?vkey=5F6B7C7B2DFD9…9EE851B2BD31B6BC1C3F03B426DF78B90E50&guid=1234567890&uin=1008611&fromtag=8 The certificate for this server is invalid. You might be connecting to a server that is pretending to be “streamoc.music.tc.qq.com” which could put your confidential information at risk.

这是因为在https下访问这个下载链接,xhr必须也要访问https的链接,否则就报错。于是改成访问https,因为对方没有证书,chrome只是警告,但safari就直接拒绝访问,所以僵住了。

@mzz2017
Copy link
Owner Author

mzz2017 commented May 15, 2018

解决方法有以下几种:

  1. 换http,不使用SSL. 于是:要么备案,要么买香港/国外服务器
  2. 后端做转发。这个用户规模大了之后比较烧流量
  3. 不使用xhr下载更名。当时使用xhr做下载是因为得到的歌曲文件名字是比较乱的,使用xhr之后才出现的这样的不兼容问题

好吧,没有十全十美的方法。

@mzz2017
Copy link
Owner Author

mzz2017 commented May 15, 2018

已经贴了个临时补丁,当出现下载故障时呈现原始链接地址

@mzz2017 mzz2017 closed this as completed May 16, 2018
@mzz2017
Copy link
Owner Author

mzz2017 commented May 16, 2018

demo站的解决方法是:换http,摒弃ssl,使用国外服务器并在api中使用国内代理

@xuelainiao
Copy link

这个办法好呀,哈哈

@xuelainiao
Copy link

奇怪了 dev 是可以的,不过pm2之后使用9000端口就出现
Cannot GET /

@mzz2017
Copy link
Owner Author

mzz2017 commented Jul 21, 2018

你好,生产部署的话使用apache或nginx将9000端口转发到与web端相同的端口的(一般是80)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants