NGINX and PATCH method: Empty reply

blacksrv

Verified User
Joined
Mar 11, 2014
Messages
7
Hi, Happy New Year to all.

I'm having problems with my just updated NGINX and PATCH method.

I updated my DA to use NGINX using this guide: http://help.directadmin.com/item.php?id=556

Everything went fine (some minor tweaks for URL re writing) except for PATCH request.

I have an app using PATCH request, I get an empty reply everytome, I tried to add it to conf file:
PHP:
	location / { 
		if ($request_method = 'PATCH') {
        		add_header 'Access-Control-Allow-Origin' '*';
	        	add_header 'Access-Control-Allow-Credentials' 'true';
		        add_header 'Access-Control-Allow-Methods' 'POST, GET, PUT, PATCH, DELETE, OPTIONS';
		}
	}

Any ideas why isn't working?
 
Hello,

By default NGINX installed with custombuild allows only "GET|HEAD|POST" methods. You need to modify its config:

Code:
        if ($request_method !~ ^(GET|HEAD|POST)$ ) {
                return 444;
        }
 
This is what I have in my nginx.conf:

PHP:
	location / { 
		if ($request_method !~ ^(GET|HEAD|POST|PATCH)$ ) {
                	return 444;
	        }
	}

But I'm getting the same, empty response. I tried to do a grep, but the only file I found with the line was on /usr/local/directadmin/custombuild/build.

What I'm missing?
 
First of all thank you for your response,

Just empty, according to my console:
ERR_EMPTY_RESPONSE

According to cUrl:
curl: (52) Empty reply from server

52 means:
CURLE_GOT_NOTHING (52)
Nothing was returned from the server, and under the circumstances, getting nothing is considered an error.

This is what I have in the LOG:

[07/Jan/2015:10:17:09 -0600] "PATCH /api/v1/Preferences/549a079ab18d1 HTTP/1.1" 444 0

So a 444 but with 0 bytes?
 
Last edited:
You should check

/etc/nginx/webapps.conf
/etc/nginx/webapps.hostname.conf
/etc/nginx/webapps.ssl.conf

as well.
 
Back
Top