NutzCN Logo
问答 请教一个关于跨域的问题
发布于 2585天前 作者 qq_54da2be9 2100 次浏览 复制 上一个帖子 下一个帖子
标签:
@IocBean
@At("/login")
@Ok("json")
@Fail("http:500")
public class UserModule {

    @At
    @Filters(@By(type=CrossOriginFilter.class))
	public String getInfo(HttpServletRequest request) {

在方法上设置了跨域,但是前端调用的时候还是会报错,求指教是什么问题

Failed to load http://localhost:8080/jackfruit/login: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8585' is therefore not allowed access.
6 回复

不要用localhost,要么域名要么ip

哦,好的 我试下看

还是会有这个错误

Failed to load http://192.168.0.103:8080/jackfruit/login: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8585' is therefore not allowed access.

跨域访问的地址写了localhost?

没有 写的是IP.

8585相关的js/html代码贴来看看

添加回复
请先登陆
回到顶部