AWS Amplify sometimes 503 service unavailable

Hi Haproxy Community,

I’m using AWS Amplify as my website hosting. The aws amplify build and server our website with their generated subdomain like “master.xxxxxxxxx.amplifyapp.com”.

Then i’m using SNI configuration to server it using haproxy, my configuration are like this :

backend website-v2
        mode http
        option forwardfor header X-Client
        http-request set-header Host master.xxxxxxxxx.amplifyapp.com
        server fe-website-v2 master.xxxxxxxxx.amplifyapp.com:443 ssl verify none sni str(master.xxxxxxxxx.amplifyapp.com)

sometimes the website goes 503 service unavailable and i mitigated it by restarting the haproxy service, anyone have the same problem or know how to solve this?

Thank You.

That will certainly happen when Amazon changes IP address. You need to setup runtime DNS resolution in haproxy, so that the IP address change can be followed without a restart.

Hi Lukas,

Thank you for your reply, have been try using resolver, everytime there’s a “check” on the server line, it always show no server available and my website become 503.
what do you think about this?

Thanks

It means the DNS resolver fails, it only works when using libc resolution…

Share the output of haproxy -vv and the full configuration please, r

Disable libc resolution completetly with init-addr and confirm this makes it fail in all cases:
default-server init-addr last,none

Simulate the actual DNS request as configured in haproxy (dig against the configured server).