What does the nginx 502 559 error code mean? - nginx

I'm getting a "502 559" error in my nginx error logs. I know that the 502 means "bad gateway". What does the 559 mean?

As mentioned by Richard Smith in the comment, 559 in the nginx log stands for:
the number of bytes in the HTML response that Nginx sent to the browser
Source:
http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
or, as specified in the docs:
$body_bytes_sent
number of bytes sent to a client, not counting the response header; this variable is compatible with the “%B” parameter of the mod_log_config Apache module

Related

What is this second number after HTTP status code?

I did grep " 500 " on the request log and got this, I understand that HTTP code is 200 but what is this 501?
POST /api/v1/url HTTP/1.1" 200 501
I suppose your server is Apache and logs are in CLF (Common Log Format).
Then 501 is the size of the server response (in bytes and in total).

Nginx: rewrite http status message in the header (not body)

In Nginx, I want to customize the status code message right after the status code:
such as this is the default:
HTTP/1.1 429
and I want to do this:
HTTP/1.1 429 Too many requests
How can I get it done please? Note this is the header not the body at all.

Nagios returning OK with check_http and status 303

Probably an easy question but search is not helping.
# ../libexec/check_http -H google.co.uk
Provides:
HTTP OK: HTTP/1.1 301 Moved Permanently - 592 bytes in 0.153 second response time|time=0.152933s;;;0.000000 size=592B;;;0
But
# ../libexec/check_http -H google.co.uk.thisisnotarealurl
Provides:
HTTP OK: HTTP/1.0 303 See Other - 212 bytes in 0.161 second response time|time=0.161133s;;;0.000000 size=212B;;;0
How can it be showing HTTP OK when the site doesn't exist?
Nagios is showing the site is OK whether it exists or not, is this normal?
Status 303 means the site is present, just somewhere else. Same for 301 (with different semantics). Thats not a Failure so yeah thats normal.
The question is why you get 303 for google.co.uk.thisisnotarealurl. Maybe some setup in your network (DNS proxy that always delivers some result? See also the comment of James_pic!)
What do you get if you hit that into a browser (from the same machine & setup of Nagios)

Location header wrong after HTTP POST?

please forgive me if I do something terribly wrong, I shall correct it at once).
I'm creating a RESTservice and I need the location of the created resources, both for testing purposes and for further development.
As far is I have understood from the rfc 2616, the location header that I get back after a HTTP POST should give me at link to the resource I have created.
14.30 Location
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion of the
request or identification of a new resource. For 201 (Created)
responses, the Location is that of the new resource which was created
by the request. For 3xx responses, the location SHOULD indicate the
server's preferred URI for automatic redirection to the resource. The
field value consists of a single absolute URI.
Location = "Location" ":" absoluteURI
An example is:
Location: http://www.w3.org/pub/WWW/People.html
link to rfc 2616
However, when I POST to create a new resource (for example with curl, but I tried different clients) as such:
curl -X POST -H "Content-Type: application/xml" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><participant><first-name>Severinus</first-name><email>severinus#gmail.com</email></participant>" -v http://localhost:8080/VCTAserverFirstTest/services/participants
This is the header I get back:
upload completely sent off: 133 out of 133 bytes
HTTP/1.1 201 Created
Server Apache-Coyote/1.1 is not blacklisted
Server: Apache-Coyote/1.1
Location: http://localhost:8080/participants/1
Content-Length: 0
Date: Sat, 19 Apr 2014 16:07:31 GMT
Connection #0 to host localhost left intact
Here the Location is http://localhost:8080/participants/1 but the resources is in fact accessed on http://localhost:8080/VCTAserverFirstTest/services/participants/1
This is not what I expected. Do you need the server side code or is there an obvious answer to this?
Thanks
Lars
EDIT: Not a good answer for anybody else, but it was solved by using the resteasy framework.

Nginx giving 400 error:

I am using Nginx to handle hits of API. I checked the access log and found that sometimes Nginx is giving 400 error.
GET /url to hit/ HTTP/1.1" **400 172** "-" "-"
What is 172 in above log ? and how to solve this error in Nginx ?
172 corresponds to the size of server response in bytes.
Source: https://easyengine.io/tutorials/nginx/log-parsing/

Resources