Fix SSL redirect excluding /health endpoint

Move exclude option inside force_ssl config so /health endpoint
is not redirected to HTTPS (needed for k8s readiness probe).
This commit is contained in:
Graham McIntire 2026-01-03 16:52:28 -06:00
parent 4216a5b7bf
commit aed28de923
No known key found for this signature in database

View file

@ -20,10 +20,7 @@ config :towerops, ToweropsWeb.Endpoint, cache_static_manifest: "priv/static/cach
# known as HSTS. If you have a health check endpoint, you may want to exclude it below.
# Note `:force_ssl` is required to be set at compile-time.
config :towerops, ToweropsWeb.Endpoint,
force_ssl: [rewrite_on: [:x_forwarded_proto]],
exclude: [
paths: ["/health"],
# Runtime production configuration, including reading
# of environment variables, is done on config/runtime.exs.
hosts: ["localhost", "127.0.0.1"]
force_ssl: [
rewrite_on: [:x_forwarded_proto],
exclude: [paths: ["/health"], hosts: ["localhost", "127.0.0.1"]]
]