I know this question is not exactly suitable for stackoverflow but still, I have the most chances of getting answer here so posting it here.
I have configured AWS EBS with Application Load Balancers for my application. The issue is, it keeps showing ELB processes are not healthy on all instances.
Now, I am trying to configure healthcheck processes for the same and following are the processes that I have added:
Process SSL: Port - 443, Protocol - HTTPS, Health check path - /health.php, HTTP Code - 200
Process Default: Port - 80, Protocol - HTTP, Health check path - /health.php, HTTP Code - 200
I have a file called health.php which returns 'healthy' with status code 200 but the ALB is still not finding the instances healthy.
Now, following things may be affecting the health check: 1. In my .htaccess file, I have following rules configured to transfer non-www traffic to www traffic and non-https traffic to https.
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Which means, if the health check process is going to non-www or non-https URL to check for the health, it's getting status code 301.
Also, if it's going to www-https url, it may be getting a security error as my SSL is only configured for my domain name. How do I correctly configure healthchecks in this scenario.