# AWS Amplify sometimes 503 service unavailable

**URL:** <https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676>\
**Category:** Help!\
**Created:** [June 24, 2021, 4:21am UTC](https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676 "2021-06-24T04:21:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillyRL](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/willyrl/32/1505_2.png) [@WillyRL](https://discourse.haproxy.org/u/WillyRL)\
**Post date:** [June 24, 2021, 4:21am UTC](https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676/1 "2021-06-24T04:21:29Z")

</div>

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](http://master.xxxxxxxxx.amplifyapp.com)”.

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [June 24, 2021, 6:03am UTC](https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676/2 "2021-06-24T06:03:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WillyRL](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/willyrl/32/1505_2.png) [@WillyRL](https://discourse.haproxy.org/u/WillyRL)\
**Post date:** [July 7, 2021, 8:56am UTC](https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676/3 "2021-07-07T08:56:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [July 7, 2021, 11:42am UTC](https://discourse.haproxy.org/t/aws-amplify-sometimes-503-service-unavailable/6676/4 "2021-07-07T11:42:49Z")

</div>

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).
