Skip to content

docs(socrate): set AdminBaseURL explicitly in production - #60

Merged
ovander merged 1 commit into
mainfrom
docs/admin-base-url
Sep 29, 2026
Merged

ovander merged 1 commit into
mainfrom
docs/admin-base-url

Conversation

@ovander

@ovander ovander commented Sep 29, 2026

Copy link
Copy Markdown
Owner

What and why

When socrate.ClientConfig.AdminBaseURL is empty, the client derives it from BaseURL, keeping the scheme and host and replacing the port with 8081 (socrate/client.go). The docs presented that as a safe default, but in the usual production layout it is wrong:

  • Behind a TLS reverse proxy, BaseURL is the public issuer (https://socrate.example.com), so the derived URL is https://socrate.example.com:8081. The admin API is plain HTTP bound to loopback (ADMIN_BIND_HOST=127.0.0.1), and the proxy never publishes it.
  • The port is the server's ADMIN_PORT. It is 8081 by default, but it moves when something else holds 8081: the layout that co-hosts Socrate with a legacy server uses 8082. A wrong port can reach a different service.
  • Backends on another host can't reach a loopback-bound admin API at all. The docs now say what such a backend can still use (JWKS and the OAuth-port methods) and what it can't (admin, app-user and policy calls).

Changes:

  • docs/CLIENT-INTEGRATION.md:
    • §3: the env table says to set SOCRATE_ADMIN_BASE_URL in production.
    • §6.1: the construction example sets AdminBaseURL.
    • §6.3: explains the three points above.
  • README.md: the SOCRATE_ADMIN_BASE_URL row in the env table.
  • socrate/client.go: the package doc and the AdminBaseURL field comment (comments only).
  • CHANGELOG.md: a line under [Unreleased] → Changed.

How it was tested

Documentation and comments only.

  • go mod tidy && git diff --exit-code go.sum leaves go.sum unchanged
  • go build ./... passes
  • go vet ./... passes
  • go test -race -count=1 -timeout=120s ./... passes
  • golangci-lint run ./... reports 0 issues
  • govulncheck ./...: not run locally (the sandbox can't reach vuln.go.dev); no dependency changed
  • A line is added under ## [Unreleased] in CHANGELOG.md

Compatibility

  • Exported-API change: no.
  • Behaviour change for existing callers: none. The derivation is unchanged; only its documentation is corrected.
  • Breaking change: none.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA


Generated by Claude Code

The AdminBaseURL derived when it is empty keeps BaseURL's scheme and host and
swaps the port for 8081. Behind a TLS reverse proxy, the usual production
layout, BaseURL is the public issuer, so the derived URL is wrong: the admin
API is plain HTTP bound to loopback on the server's ADMIN_PORT, which is 8082
where a legacy server holds 8081. The integration guide, the README
environment table and the package doc now say to set it (e.g.
http://127.0.0.1:8081), where the port comes from, and what a backend on
another host can still call. No code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
@ovander
ovander merged commit bac10c1 into main Sep 29, 2026
3 checks passed
@ovander ovander mentioned this pull request Sep 30, 2026
1 task done
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.

2 participants