我正在尝试添加一个 http 标头并重定向到外部 url。但不知何故,标头值在外部 url 上读取为 null。我知道我们可以传递属性,但我需要的是一个 http 标头
@RequestMapping("/sso")
public String sso(@RequestParam("username") final String username,
@RequestParam("password") final String password,
@RequestParam("TARGET") final String TARGET,
HttpServletResponse response, Model model) {
// validate user
// set response token
response.addHeader("token", "abcd1234xyz56sa");
// return "success";
return "redirect:" + TARGET;
}
Run Code Online (Sandbox Code Playgroud)