Skip to content

🔧 fix (compose): APP_BASE_URL follows HTTP_PORT override#76

Merged
mrdavidlaing merged 1 commit into
mainfrom
fix/appbaseurl-http-port
Apr 20, 2026
Merged

🔧 fix (compose): APP_BASE_URL follows HTTP_PORT override#76
mrdavidlaing merged 1 commit into
mainfrom
fix/appbaseurl-http-port

Conversation

@mrdavidlaing

Copy link
Copy Markdown
Contributor

Summary

  • Nest HTTP_PORT into the APP_BASE_URL default in apps/sbomify/deployments/compose/docker-compose.yml (lines 8 and 200) so an operator-supplied HTTP_PORT flows through to login redirects instead of being stranded at :8000.

Why

When operators override HTTP_PORT, Caddy correctly binds the new port, but APP_BASE_URL still defaulted to http://127.0.0.1:8000. That fed the wrong port into the Keycloak redirect_uri, so login flows sent users back to :8000 and broke the quickstart for anyone not on the default port.

Test plan

  • docker compose config with no env → APP_BASE_URL: http://127.0.0.1:8000 (unchanged)
  • HTTP_PORT=9000 docker compose configAPP_BASE_URL: http://127.0.0.1:9000
  • APP_BASE_URL=http://example.com docker compose config → explicit override still wins
  • Full stack up with HTTP_PORT=9998 docker compose up --wait: backend env shows APP_BASE_URL=http://127.0.0.1:9998; /login/ redirects to .../accounts/oidc/keycloak/login/; OIDC hop carries redirect_uri=http%3A%2F%2F127.0.0.1%3A9998%2F...; Keycloak returns HTTP 200 (accepts the redirect URI).

Notes

  • Quickstart README suggests HTTP_PORT=9000 as an example, but that collides with MinIO's default :9000 binding. Tested with 9998 instead; the fix itself is port-agnostic. Worth a separate yak if the README should change.
  • KC_HOSTNAME on line 35 has the same hardcoded-port shape against KEYCLOAK_PORT. Out of scope here, but a candidate for a follow-up.

🤖 Generated with Claude Code

When operators overrode HTTP_PORT, login redirects still pointed at
:8000 because APP_BASE_URL's default was hardcoded. Nest HTTP_PORT
into the default so the two stay in sync. Verified with HTTP_PORT=9998:
Keycloak redirect_uri and the backend env both resolve to :9998.

Co-Authored-By: Yakueline (Claude) <noreply@anthropic.com>
@mrdavidlaing mrdavidlaing merged commit 6807f69 into main Apr 20, 2026
8 checks passed
@mrdavidlaing mrdavidlaing deleted the fix/appbaseurl-http-port branch April 20, 2026 07:51
mrdavidlaing pushed a commit that referenced this pull request Apr 20, 2026
Same nested-default shape as PR #76 (APP_BASE_URL). When operators
overrode KEYCLOAK_PORT, the container bound the new port but
KC_HOSTNAME still defaulted to :8180, so browsers were sent to the
wrong port. Nest KEYCLOAK_PORT into the default so the two stay
in sync. Verified via `docker compose config`: default resolves to
:8180, KEYCLOAK_PORT=9180 resolves to :9180, explicit KC_HOSTNAME
override still wins.

Co-Authored-By: Bob (Claude) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant