慕丝24128
2018-06-24 20:25
a调用b,已经在b添加了cookie,就是报错
Resolved exception caused by Handler execution: org.springframework.web.bind.ServletRequestBindingException: Missing cookie 'coo' for method parameter of type String
今天又试了试, 是我错了, 原因是我把cookie添加到了 http://127.0.0.1:8080域名下,这样就会报Missing cookie 'xxx' for method parameter of type String
因为ajax的url写的是http://localhost:8080, 这样自然读不到127.0.0.1:8080下的cookie,
请注意localhost和127.0.0.1是两个域, 一定要确保一致
讲师是对的, A发ajax请求给B, 带着的是B的cookie, 还是受限于同源策略, ajax的Request URL是B, cookie就是B的
我也报这个错, 然后我把cookie加到客户端, 也就是8081端口上, 把服务端(8080)的cookie删掉, 就行了.
我认为讲师讲的不对, 发起人才能带cookie, 你从8081访问8080, ajax带着的是8081的cookie
coo 拼写检查了吗
ajax跨域完全讲解
62542 学习 · 100 问题
相似问题