我的应用程序在 POST 操作后将一些信息重定向到 GET 控制器,但在与 Apache 和反向代理一起使用时会丢失信息。当我在中间没有反向代理的情况下执行此操作时,一切正常。一些想法?
@PreAuthorize("hasRole('ROLE_ADMIN')")
@RequestMapping(value = "aCategory", method = RequestMethod.POST)
public String category(@RequestParam("aCategoryName") String name, Model model, RedirectAttributes attr,
HttpServletRequest request) {
String redirect = "redirect:" + "http://localhost:8080/aCategory";
aService.saveACategory(name);
attr.addFlashAttribute("aCategoryName", name);
return redirect;
}
@RequestMapping(value = "aCategory", method = RequestMethod.GET, produces = "text/html")
public String appCategory(Model model, Principal principal) {
String name = principal.getName(); // get logged in username
model.addAttribute("username", name);
return "aCategory";
}