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
Finally after three agonizing days, I found the problem and boy was it stupid.
The problem was that I have enabled csrf
protection in spring security. And that was causing my post requests to be forbidden which triggers the access-denied-handler
error page, since I have not mapped my access-denied-handler
to the "/403"
error page as shown below, my http 403/401
was being masked by the http 404
So in Short
access-denied-handler
error page to a valid url$.ajax({method :'POST', url : '/ajax',data : {"${_csrf.parameterName}" : "${_csrf.token}"}});