-
Notifications
You must be signed in to change notification settings - Fork 125
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
跨域问题如何解决? #1
Comments
项目使用 Golang 开发,打包生成的可执行文件可直接运行,无需使用 php。 没有使用过宝塔,建议服务器上看看 跨域问题的话,我线上使用nginx配置反向代理,前端请求没有问题。
|
很奇怪,我这边还是不行,我的配置是这样的 首先短链接使用 https://link.mfy.cool 作为域名 然后后端输入 然后在宝塔的反向代理里面 反向代理http://link.mfy.cool:8001 -> http://link.mfy.cool SSL证书已申请 然后在反向代理配置里面加入 最后宝塔的反向代理配置如下: #PROXY-START/
location /
{
proxy_pass http://link.mfy.cool:8001;
proxy_set_header Host link.mfy.cool;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header 'Access-Control-Allow-Origin' '*';
}
#PROXY-END/ 前端的 最后使用的时候发现还是报错跨域缺少Access-Control-Allow-Origin 我人傻了。。。完全不知道错在哪里,请大佬指教一下,万分感谢了! |
您好Carey,
在配置了一上午这个MyUrls之后我发现还是无法运行,subweb始终报错跨域有问题,我是宝塔面板安装的redis,php也安装了redis插件,redis-cli正常运行,后端地址配置无误,所有文件使用最新master。
跨域问题我在短链接反向代理配置文件中加入了
始终无效,后续换了很多也持续报错,请问这个跨域该怎么配置才是正确的呢?
The text was updated successfully, but these errors were encountered: