I have simple configuration file that is used to server custom 503 error page at a time of maintenance. The relevant part is this:
server {
listen 80 default;
root /usr/share/nginx/html;
server_name example.com;
location / {
if (-f $document_root/503.json) {
return 503;
}
}
# error 503 redirect to 503.json
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /503.json break;
}
}
The problem is Nginx figures out that any request resolves in a static file and any POST, PUT and DELETE requests get 405 (method not allowed) response.
So the question is: how do I tell Nginx to serve my page for any HTTP method?