> ## Documentation Index
> Fetch the complete documentation index at: https://docs.springwinter.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix ALB 502, 503, health checks and HTTPS

> Separate unhealthy application targets from routing, DNS and certificate errors, and verify HTTP and HTTPS without disabling security protections.

A load-balancer error is evidence about request routing, not a complete diagnosis. With SpringWinter, inspect the web server's History and application logs, then check the target and domain state. The same checks apply to an Application Load Balancer you manage directly.

## Interpret the symptom

| Symptom | Common causes | Diagnostic and resolution |
| - | - | - |
| ALB 502 | Target closes/resets connections, malformed response, protocol mismatch | Check application crashes, upstream timeouts and target logs at the request time; distinguish ALB-generated errors from application-generated 502 |
| ALB 503 | No usable registered targets or routing mismatch | Check target registration/state and listener rule; wait for healthy replacements or correct failed startup |
| Health check fails | Wrong port/path, login redirect, slow startup, security-group routing | Test the configured HTTP port and unauthenticated health path inside the deployment; a public HTTPS redirect is not a valid internal health response |
| Long responses stop | Idle timeout, buffering or application cancellation | Test actual streaming intervals, flush behavior and reconnect; do not raise timeouts without checking resource use |
| Wrong application on custom host | DNS points elsewhere or listener hostname mismatch | Compare authoritative DNS, project hostname and load-balancer listener routing |
| TLS name mismatch | Certificate lacks hostname or stale DNS | Inspect the served certificate for the exact hostname; fix DNS/certificate attachment rather than disabling verification |
| Certificate pending validation | Missing/wrong CNAME, DNS provider rewriting, restrictive CAA | Copy the precise requested record and verify its authoritative answer; allow issuance only for the intended hostname |

AWS's [load-balancer troubleshooting reference](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html) lists status-specific causes. A 502 is not always an out-of-memory error, and a 503 is not always a DNS problem.

## Scoped checks you can run

```sh theme={null}
curl --fail-with-body --silent --show-error --max-time 20 "$APP_URL/health"
dig +short "$APP_HOST"
aws elbv2 describe-target-health --profile "$AWS_PROFILE" \
  --region "$AWS_REGION" --target-group-arn "$TARGET_GROUP_ARN" \
  --query 'TargetHealthDescriptions[].{target:Target.Id,state:TargetHealth.State,reason:TargetHealth.Reason,description:TargetHealth.Description}'
```

Use the application's actual health path instead of assuming `/health`. The AWS command requires your authorized account and an observed target-group ARN. Review output privately. Never use `curl -k` as a fix for certificate errors or open a database/security group to the internet to diagnose HTTP.

## SpringWinter domains

The generated application hostname remains available when a custom hostname is added. Publish the DNS and certificate-validation records shown in settings. SpringWinter does not own your external DNS account. A certificate request is not completed HTTPS: verify the certificate is attached and the browser receives it for the intended hostname.

Keep application authentication separate from liveness. A minimal health endpoint can return 200 without exposing configuration, database credentials or user information. Test dependency readiness separately so a transient downstream failure does not cause a destructive restart loop.

## Prevent recurrence and verify

Set consistent application port and health configuration, provide graceful shutdown, and budget enough startup time for the selected image. Keep schema migrations separate from uncontrolled per-replica startup. After repair, verify HTTPS, redirect behavior, application authentication, one representative action and logs from the replacement tasks. Test a streaming/WebSocket client through an actual replacement before claiming reconnect safety.

Read [web servers](https://docs.springwinter.dev/deploy/web-servers.md), [build and task errors](https://docs.springwinter.dev/troubleshooting/deployments.md), and [architecture](https://docs.springwinter.dev/concepts/architecture.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.