I'm working on a project of RESTful web services, i'm using Apache Tomcat and JAX-RS.
I want to accept DELETE requests from client but whenever i send a DELETE request from Advanced REST client Chrome plugin it gives response code 403 Forbidden.
So how can i make Apche Tomcat accept DELETE request?
One more suggestion, double check the URL of your call and make sure it points to your intended servlet.
I got the same error when I mistyped a service URL in my code. I had
api/roles/Service/roles
when I neededapi/rolesService/roles
, fixing the typo resolved the error.You would expect a 404, but with DELETE on Tomcat, you get a 403.To enable other http methods in tomcat, configure in web.xml
Parameters
debug
andlistings
are loaded by default in tomcat, while the defaultreadonly
is true, meaning that only GET and POST are available.Other params available are:
Here are the reasons why you can get a 403 Forbidden from Tomcat for a DELETE request:
Source: http://tomcat.apache.org/tomcat-5.5-doc/catalina/funcspecs/fs-default.html
Make sure you adhere to the tomcat specifications to avoid any problem.
Tomcat was blocking DELETE methods for me because of my CORS filters.
I needed new filters registered in my web.xml file. Here's an example of a very permissive one: