AWS load balancer and maintenance page

后端 未结 4 1708
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 06:21

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

This page need to return 503 HTTP code, bec

4条回答
  •  一生所求
    2021-02-07 06:45

    I've been searching for a quick way to do this. We need to return a 503 error to the world during DB upgrade, but white list a few IPs of developers so they can test it before opening back up to public.

    Found a one spot solution:: Go to the Loader Balancer in EC2 and select the load balancer you would like to target. Below, you should see Listeners. Click on a listener, and edit the rule. Create a rule like this:

    Now everyone gets a pretty maintenance page returned with a 503 error code, and only two IP addresses in the first rule will be able to browse to the site. Order is important, where the two IP exceptions are on top, then it goes down the list. The last item is always there by default.

    Listener Rules for Your Application Load Balancer: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html

提交回复
热议问题