Edit online

CSRF Filter Denies HTTP Request

Problem

I received a "Post request denied by CSRF filter" error message when posting an HTTP request to the servlet.

Cause

The request was denied by the Cross-Site Request Forgery (CSRF) filter that helps to prevent malicious attacks. This happens when the X-Requested-With header is missing from non-GET requests.

Solution

To solve this issue, set the X-Requested-With header in your request. It can have any value.