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

浏览器如何向AndServer的接口发起跨域请求? #500

Open
kaiaiz opened this issue Jun 16, 2023 · 2 comments
Open

浏览器如何向AndServer的接口发起跨域请求? #500

kaiaiz opened this issue Jun 16, 2023 · 2 comments

Comments

@kaiaiz
Copy link

kaiaiz commented Jun 16, 2023

启动了vue的浏览器本地服务向另一个机子的AndServer的接口发起跨域请求,此时浏览器提前发起了一个OPTIONS预检请求,响应返回‘CORS ERROR’的错误。
想设置响应头的CORS,但是setHeader无效,响应头没有加上'access-allow-origin'这样的头。
另外如何把响应头的'connection:close'改为keep-alive?

@Waylawww
Copy link

+1

@yanzhenjie
Copy link
Owner

给对应的接口加上注解:@CrossOrigin就可以了,注解中是和SpringMCV一样的字段。

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

No branches or pull requests

3 participants