The correct way to deploy caddy to AWS ECS (Fargate), task definition keeps respawning

You don’t need this line, the builder image already comes with xcaddy.

Are you sure this is what you want? This’ll build the latest version from Caddy’s git repo, which has no stability guarantees.

Remove this, it’s a no-op (does nothing).

Remove these, those are response headers but you’re using them with header_up which sets request headers. It’s a mismatch.

You upstream app should read from X-Forwarded-For instead.

Is this running inside your container? It might be that curl isn’t installed in the container.

You can add it with RUN apk add curl