[GH-ISSUE #5] 跨域问题 #3

Closed
opened 2026-02-27 07:09:42 +03:00 by kerem · 8 comments
Owner

Originally created by @xdd-0920 on GitHub (Feb 11, 2023).
Original GitHub issue: https://github.com/imsyy/SPlayer/issues/5

你好,网站很喜欢,我部署后遇到跨域请求的问题,请问下这个代码怎么解决呀

Originally created by @xdd-0920 on GitHub (Feb 11, 2023). Original GitHub issue: https://github.com/imsyy/SPlayer/issues/5 你好,网站很喜欢,我部署后遇到跨域请求的问题,请问下这个代码怎么解决呀
kerem closed this issue 2026-02-27 07:09:42 +03:00
Author
Owner

@imsyy commented on GitHub (Feb 11, 2023):

我的 api 开启了跨域限制,你可以尝试使用自己搭建的 api

<!-- gh-comment-id:1426777908 --> @imsyy commented on GitHub (Feb 11, 2023): 我的 api 开启了跨域限制,你可以尝试使用自己搭建的 api
Author
Owner

@xdd-0920 commented on GitHub (Feb 11, 2023):

image
官网文档说是在调用的时候增加相关代码,是不是在调用时即SPlayer扫码时才可以解决

<!-- gh-comment-id:1426789948 --> @xdd-0920 commented on GitHub (Feb 11, 2023): ![image](https://user-images.githubusercontent.com/32973810/218264389-320f632d-1999-4df3-8c35-1ba335b5a5f8.png) 官网文档说是在调用的时候增加相关代码,是不是在调用时即SPlayer扫码时才可以解决
Author
Owner

@imsyy commented on GitHub (Feb 11, 2023):

image
官网文档说是在调用的时候增加相关代码,是不是在调用时即SPlayer扫码时才可以解决

这一点我已经做了处理了,你是用自己的 api 还跨域吗?报错截图我瞅瞅

<!-- gh-comment-id:1426792541 --> @imsyy commented on GitHub (Feb 11, 2023): > ![image](https://user-images.githubusercontent.com/32973810/218264389-320f632d-1999-4df3-8c35-1ba335b5a5f8.png) > 官网文档说是在调用的时候增加相关代码,是不是在调用时即SPlayer扫码时才可以解决 这一点我已经做了处理了,你是用自己的 api 还跨域吗?报错截图我瞅瞅
Author
Owner

@xdd-0920 commented on GitHub (Feb 11, 2023):

1676128137004
用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错

<!-- gh-comment-id:1426795580 --> @xdd-0920 commented on GitHub (Feb 11, 2023): ![1676128137004](https://user-images.githubusercontent.com/32973810/218266054-63fd541c-f59a-4b4a-808e-d17b6226d93d.jpg) 用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错
Author
Owner

@imsyy commented on GitHub (Feb 11, 2023):

1676128137004
用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错

我的示例站点你能扫码登录嘛?
或者你也可以试试将 api 源码中的
https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145
加入自己的域名

<!-- gh-comment-id:1426802907 --> @imsyy commented on GitHub (Feb 11, 2023): > ![1676128137004](https://user-images.githubusercontent.com/32973810/218266054-63fd541c-f59a-4b4a-808e-d17b6226d93d.jpg) > 用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错 我的示例站点你能扫码登录嘛? 或者你也可以试试将 api 源码中的 https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145 加入自己的域名
Author
Owner

@xdd-0920 commented on GitHub (Feb 11, 2023):

1676128137004
用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错

我的示例站点你能扫码登录嘛? 或者你也可以试试将 api 源码中的 https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145 加入自己的域名

示例网站我能扫码登录成功

<!-- gh-comment-id:1426806374 --> @xdd-0920 commented on GitHub (Feb 11, 2023): > > ![1676128137004](https://user-images.githubusercontent.com/32973810/218266054-63fd541c-f59a-4b4a-808e-d17b6226d93d.jpg) > > 用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错 > > 我的示例站点你能扫码登录嘛? 或者你也可以试试将 api 源码中的 https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145 加入自己的域名 示例网站我能扫码登录成功
Author
Owner

@xdd-0920 commented on GitHub (Feb 11, 2023):

1676128137004
用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错

我的示例站点你能扫码登录嘛? 或者你也可以试试将 api 源码中的 https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145 加入自己的域名

image
扫码后调用api没有响应头
image
zhe'ge这个是预检的代码是有响应头的

<!-- gh-comment-id:1426810202 --> @xdd-0920 commented on GitHub (Feb 11, 2023): > > ![1676128137004](https://user-images.githubusercontent.com/32973810/218266054-63fd541c-f59a-4b4a-808e-d17b6226d93d.jpg) > > 用的是我自己的api,首页加载、播放歌曲都没问题,只有扫码登录会报错 > > 我的示例站点你能扫码登录嘛? 或者你也可以试试将 api 源码中的 https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/server.js#L145-L145 加入自己的域名 ![image](https://user-images.githubusercontent.com/32973810/218268282-61cc5f3c-7854-46bf-a6ea-dfe5817d1700.png) 扫码后调用api没有响应头 ![image](https://user-images.githubusercontent.com/32973810/218268323-323e9dec-66da-4768-99cb-b72973401bef.png) zhe'ge这个是预检的代码是有响应头的
Author
Owner

@imsyy commented on GitHub (Feb 13, 2023):

您好,请问问题解决了嘛 😂,你那边的网站我这访问不了

<!-- gh-comment-id:1427258756 --> @imsyy commented on GitHub (Feb 13, 2023): 您好,请问问题解决了嘛 😂,你那边的网站我这访问不了
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SPlayer#3
No description provided.