Warning: Use of undefined constant HTTP_USER_AGENT - assumed 'HTTP_USER_AGENT' (this will throw an Error in a future version of PHP) in /var/www/html/linuxbyimraan.co.za/wp-content/themes/voice-blog/header.php on line 1
Lightsail Loadbalancer failing health checks – LinuxByImraan

Lightsail Loadbalancer failing health checks

If you using an AWS Lightsail loadbalancer and running a Bitnami instance with an http to https redirect, the chances are that you loadbalancer is failing its health check.


Well the lightsail loadbalancer does a health check on port 80 and if you doing redirect from 80 to 443, this health check will fail.

How do I fix this?

Create a file specifically for passing this health check in the wordpress documentroot:

$ echo “HTTP health check” >> /opt/bitnami/apps/wordpress/htdocs/health.html

After creating the health check file, you will need to edit the configuration file:

in /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf or /opt/bitnami/apache2/conf/bitnami/bitnami.conf

# Change
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

# To
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/health.html
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

save and quit. :wq!

#Restart apache:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Now you should be able to load the health.html page via HTTP, for example:


# Or even using your domain name


No token or token has expired.

Leave a Reply

Your email address will not be published. Required fields are marked *