Per the https://deploy-docs.aptible.com/docs/https-endpoints#traffic documentation:
[HTTP(S) Endpoints] handle HTTPS termination (and optionally redirect HTTP traffic to HTTPS), and pass it on as HTTP traffic to your app Containers.
Since the application always sees the protocol as http
even when the Endpoint is accessed using https
, it’s redirecting from https
to https
indefinitely (AKA a redirect loop).
The recommended method for redirecting from HTTP to HTTPS is to configure the App with FORCE_SSL=true
. Doing this and removing the redirection from your application should solve the problem. See the HTTPS Redirect documentation for more details.
If you would like to access the original protocol in the application, you can retrieve it from the the X-Forwarded-Proto
header. The main thing to watch out for is that https://deploy-docs.aptible.com/docs/health-checks always connect via HTTP. By default, this won’t be an issue but if you enable Strict Health Checks you’ll need to allow HTTP on /healthcheck
or health checks will fail as discussed in this topic.