Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#2204 closed defect (invalid)

proxy_cache_methods DELETE

Reported by: jonas.jasas@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.19.x
Keywords: Cc:
uname -a: Linux test 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 1.1.1 11 Sep 2018
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-Iwde_Y/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module

Same error with the Nginx 1.21.0

Description

Documentation:
Syntax: proxy_cache_methods GET | HEAD | POST ...;

If I use this in location:
proxy_cache_methods DELETE;

Getting this error:
2021/06/10 07:51:39 [emerg] 1#1: invalid value "DELETE" in /etc/nginx/nginx.conf:133

Change History (3)

comment:1 by Maxim Dounin, 3 years ago

Resolution: invalid
Status: newclosed

The error is expected, and perfectly agree with the directive syntax. Note that syntax explicitly documents that only GET, HEAD, and POST methods can be specified (though you can specify more than one method, hence ...).

As of now, you can't cache DELETE requests using nginx. Note well that responses to DELETE requests are not cacheable per RFC 7231.

comment:2 by jonas.jasas@…, 3 years ago

... is confusing. Why there should be limitations like this what are the benefits from that? It just makes Nginx less suitable for custom cases. DELETE was just an example there could be custom HTTP methods.

in reply to:  2 comment:3 by Maxim Dounin, 3 years ago

Replying to jonas.jasas@…:

... is confusing.

Ellipses are used to denote that one or more occurrences of an argument are allowed. This is a standard syntax notation used in many places, see POSIX for an example.

Why there should be limitations like this what are the benefits from that? It just makes Nginx less suitable for custom cases. DELETE was just an example there could be custom HTTP methods.

Main reasons are simplicity and effectiveness of the code. If you think that caching of custom HTTP methods needs to be introduced, consider filing a feature request or submitting a patch. Make sure to provide good use cases though.

Note: See TracTickets for help on using tickets.