给网站配置跨域

前言

最近有些使用本站解析源码的朋友说解析缓存到服务器的链接无法播放,,,是我的锅,没有在源码里说明情况,缓存到服务器的资源需要配置跨域才可以实现播放,方法如下:

方法

进入宝塔面板,在 网站->配置文件 中间任意部分添加:

nginx:

add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'POST,PUT,GET,DELETE';
add_header Access-Control-Allow-Headers 'version, access-token, user-token, Accept, apiAuth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With'; 

apache:

Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"


—— 本页内容已结束,喜欢请分享 ——
© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容