ELB health check fails if path is anything but root

0

I've got an Application ELB running in front of a Target Group that currently has only 1 instance, a web server (NGINX) running a WordPress site.

The ELB's health check fails with a 404 error unless I set the path to the web server's root directory ("/"). The ELB seems to be directing traffic fine--I can browse anywhere on the site no problem, including to a special file I created just for the health check (health-check.php).

I looked in my web server's access log to see what exactly is happening when the ELB health check tries to ping a file:

172.31.36.39 - - [12/Jul/2020:13:38:41 +0000] "GET /health-check.php HTTP/1.1" 404 134 "-" "ELB-HealthChecker/2.0"

But if I point the health checker to the root it works fine:

172.31.28.14 - - [12/Jul/2020:13:59:42 +0000] "GET / HTTP/1.1" 200 396 "-" "ELB-HealthChecker/2.0"

I'm going round and round in circles here trying to figure this out but can't seem to pinpoint the problem.

Any advice or help would be hugely appreciated.

Why does the server return a 404 code to the health checker but returns a 200 when I access the same exact file with my browser?

asked 4 years ago4118 views
2 Answers
0

I resolved this: the health checker apparently communicates to the server without using the domain name assigned to it and I had inadvertently left something in the NGINX config. that pointed any requests other than those with the domain name to a different root location. So the health checker wasn't actually looking in the right root directory. My mistake.

answered 4 years ago
0

I figured it out...see my last post.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions