java SetCookie标头已从响应Spring boot中删除
我有简单的@RestController,我正在尝试添加cookies,但在响应中没有看到它。添加任何其他响应头都可以,但是如果我使用。addCookie()或。addHeader(“设置Cookie”、“某物”)正在被过滤掉。此外,没有实现自定义过滤器
如何禁用此功能并将cookie添加到响应
Spring安全配置:
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.authorizeRequests()
.anyRequest()
.permitAll();
# 1 楼答案
控制器代码:
启动应用程序后,自定义cookie正常工作:
我想,你最好发布你的代码来解决这个问题