Apache Traffic Server (ATS) Returning 403 For DELETE HTTP Requests
Category : How-to
Here is a quick snippet which solves an issue I ran into today. I’ve recently set up Apache Traffic Server to reverse proxy requests to various Docker containers. It all works great and runs itself in Docker.
One thing, however, with a default install of Apache Traffic Server is that it doesn’t allow DELETE HTTP requests from any source other than localhost. Instead, the 403 Forbidden status code is returned which can cause some curious side effects for front end web applications.
The fix is simple enough, when you know where to look. ATS has a config file called ip_allow.config that controls, believe it or not, which http methods are allowed for different source IP addresses. The default file looks like this:
# # ip_allow.config # # Documentation: # https://docs.trafficserver.apache.org/en/latest/admin-guide/files/ip_allow.config.en.html # # Rules: # src_ip=<range of IP addresses> action=<action> [method=<list of methods separated by '|'>] # # Actions: ip_allow, ip_deny # # Multiple method keywords can be specified (method=GET method=HEAD), or # multiple methods can be separated by an '|' (method=GET|HEAD). The method # keyword is optional and it is defaulted to ALL. # Available methods: ALL, GET, CONNECT, DELETE, HEAD, OPTIONS, # POST, PURGE, PUT, TRACE, PUSH # # Rules are applied in the order listed starting from the top. # That means you generally want to append your rules after the ones listed here. # # Allow anything on localhost (this is the default configuration based on the # deprecated CONFIG proxy.config.http.quick_filter.mask INT 0x482) src_ip=127.0.0.1 action=ip_allow method=ALL src_ip=::1 action=ip_allow method=ALL # Deny PURGE, DELETE, and PUSH for all (this implies allow other methods for all) src_ip=0.0.0.0-255.255.255.255 action=ip_deny method=PUSH|PURGE|DELETE src_ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff action=ip_deny method=PUSH|PURGE|DELETE
Take a look at the bottom few lines. They state that PUSH, PURGE and DELETE should all be denied to all IP ranges.
To enable the DELETE http method from all IPs, simply remove the DELETE method from the bottom 2 lines. You should be left with something looking like this:
src_ip=127.0.0.1 action=ip_allow method=ALL src_ip=::1 action=ip_allow method=ALL # Deny PURGE, DELETE, and PUSH for all (this implies allow other methods for all) src_ip=0.0.0.0-255.255.255.255 action=ip_deny method=PUSH|PURGE src_ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff action=ip_deny method=PUSH|PURGE
It’s a curious default to have, but it could stop destructive API calls being made if endpoints were accidentally made public.