How to make Apache Tomcat accept DELETE method

前端 未结 4 1876
走了就别回头了
走了就别回头了 2020-12-06 02:23

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 req

4条回答
  •  渐次进展
    2020-12-06 02:45

    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:

    
        CorsFilter
        org.apache.catalina.filters.CorsFilter
        
            cors.allowed.headers
            Accept,Accept-Encoding,Accept-Language,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization,Connection,Content-Type,Host,Origin,Referer,Token-Id,User-Agent, X-Requested-With
        
        
            cors.allowed.origins
            *
        
        
            cors.allowed.methods
            GET, POST, PUT, DELETE, OPTIONS, HEAD
        
    
    
        CorsFilter
        /*
    
    

提交回复
热议问题