0 votes
1 view
in AWS by (19.2k points)

I'm using AWS Load Balancer with 3 EC2 servers, and I'm trying to serve a Maintenance page when the site is under maintenance.

This page needs to return 503 HTTP code because it is a proper code for a maintenance mode and will prevent possible problems with SEO.

When I return 503 code from any of my servers, Load Balancer makes it "Not In Service", and when all servers return 503, the website returns a blank page (because all servers are disconnected).

My questions are:

1) Is there any way to serve a custom static page with a message for visitors from Load balancer if there are no healthy servers?

2) Or how to configure Load Balancer's Health Check that it will not consider 503 as a reason to mark the server as "unhealthy"?

1 Answer

0 votes
by (44.6k points)

In your application server, add an additional route for the health check maintenance. Let us keep it as /heal, so whenever you want to go into maintenance mode so that /heal will return 200 OK instead of / (root) or /index.html. Because both the paths will return 503 Service Unavailable. After maintenance, you can revert the changes.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...