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

cors问题 #40

Closed
skycgz opened this issue Jul 13, 2020 · 9 comments
Closed

cors问题 #40

skycgz opened this issue Jul 13, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@skycgz
Copy link

skycgz commented Jul 13, 2020

src: 192.168.7.x
dst: 192.168.14.249
err: Access to XMLHttpRequest at 'http://192.168.14.249:8080/api/v1/login/username' from origin 'http://192.168.14.249:32000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

@lizeyun
Copy link

lizeyun commented Jul 13, 2020

同问~

@lizeyun
Copy link

lizeyun commented Jul 13, 2020

同问~
已解决,通过ng 转发一层就可以了。
image

@Ethan30k
Copy link

同问~
已解决,通过ng 转发一层就可以了。
image

请问你config.js里面的地址写的是ip端口还是域名呢?

@lizeyun
Copy link

lizeyun commented Jul 14, 2020

同问~
已解决,通过ng 转发一层就可以了。
image

请问你config.js里面的地址写的是ip端口还是域名呢?

我写的就是域名 ph.xx.cn
image

@SenCoder
Copy link
Contributor

后端代码里面对跨域处理的配置如下:
AllowOrigins: []string{"http://10...:", "http://localhost:", "http://127.0.0.1:", "http://172...:", "http://192.*.*.*:*"}
所以一般用 ng 就不会有问题,或者稍微修改下后端代码,允许你所在域发起请求 ~

@wocswang
Copy link

同问〜
已解决,通过ng返回一层就可以了。
图片

不用域名用ip可以吗

@70data 70data added enhancement New feature or request help wanted Extra attention is needed question Further information is requested and removed enhancement New feature or request help wanted Extra attention is needed labels Jul 15, 2020
@jayryu
Copy link
Collaborator

jayryu commented Jul 15, 2020

src: 192.168.7.x
dst: 192.168.14.249
err: Access to XMLHttpRequest at 'http://192.168.14.249:8080/api/v1/login/username' from origin 'http://192.168.14.249:32000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

已解决,请下载最新镜像

@jayryu jayryu closed this as completed Jul 15, 2020
@70data 70data added bug Something isn't working and removed question Further information is requested labels Jul 16, 2020
@SuperDlt
Copy link

src: 192.168.7.x
dst: 192.168.14.249
err: Access to XMLHttpRequest at 'http://192.168.14.249:8080/api/v1/login/username' from origin 'http://192.168.14.249:32000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

已解决,请下载最新镜像

我运行doraemon的时候也遇到了这个问题,请问最新镜像要怎么下载呀?

@purpllee
Copy link

同问~
已解决,通过ng 转发一层就可以了。
image

请问是在宿主机的nginx里修改还是镜像力的nginx

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
None yet
Development

No branches or pull requests

9 participants