Spring Security - All JQuery Ajax post requests return 404

后端 未结 4 996
说谎
说谎 2021-02-05 23:14

All my $.ajax, both POST and GET were working fine, but as soon as I integrated Spring security 3.2.6 into my project the

4条回答
  •  星月不相逢
    2021-02-06 00:07

    There is one more situation that must be consulted specially when you are implementing spring security 4, one needs form button (not "a href").

    https://spring.io/blog/2013/08/21/spring-security-3-2-0-rc1-highlights-csrf-protection/#ajax-requests.

    A> form post request sent: input type hidden in both login/logout buttons

    
    

    B> For AJAX post request add following in your JSP page after taglib declarations.

    
    
    

    and some where above closing body tag in jsp any where as it "on ready"

    
    

    It should work! if you have CORS issues still remaining, see article below. http://www.html5rocks.com/en/tutorials/cors/

提交回复
热议问题