0

I have a server setup with the name 'api.mydomain.com'. I have an error being generated by the application, and the error text is being appropriately logged as:

[error] 9#9: *6916 FastCGI sent in stderr: "application error removed" while reading response header from upstream, client: 172.24.0.5, server: *.api.mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://172.24.0.3:9000", host: "hostmaster.anotherdomain.com"

However...I am completely confused as to where the domain "hostmaster.anotherdomain.com" is coming from.

It is another domain I control, and that domain has a wildcard subdomain setup, so it resolves to the same IP address as 'api.mydomain.com'. But I would much rather than correct host name was used.

Any ideas where that host name can be coming from? Or how to tell (presumably) Nginx to use the correct host name in the log?

  • Is it possible that the logged request line has been mutated somehow, and the raw request was actually GET http://hostmaster.anotherdomain.com/ HTTP/1.1\r\nHost: foo.api.mydomain.com\r\n (although I can't replicate this, it seems the most likely answer) – DaveRandom Sep 1 at 14:21
2

In nginx error log entries such as this:

The "server:" indicates the server_name of the server block which handled the request.

The "host:" indicates the hostname sent by the browser or user agent in the Host: request header.

  • Very peculiarly, that doesn't appear to be true in this case. I was testing it myself, and requesting a page with the api.mydomain.com name, and it was being logged as "hostmaster.anotherdomain.com". And then suddenly this behaviour stopped after I rebooted nginx, and it now seems that the correct domain named is being used. For which I have no explanation. – Danack Aug 31 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.