Spring returns HTTP 405 for every HTTP POST which isn't authorized

ぐ巨炮叔叔 提交于 2019-12-02 00:33:30

I had a similar problem. The problem was in controller, which handled error pages and supported only GET method. When I changed it to both GET and POST it started work.

Example:

@Controller
public class ErrorController {
    @RequestMapping(value = "/error" method = {RequestMethod.GET, RequestMethod.POST})
    public String error(@RequestParam(value = "err", required = false) Integer paramErrorCode, Locale locale,
            ModelMap model, HttpServletRequest httpRequest) {
         // Do something   
     }

See details https://stackoverflow.com/a/57571936/1839027

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!