docs(socrate): set AdminBaseURL explicitly in production - #60
Merged
Merged
Conversation
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
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
When
socrate.ClientConfig.AdminBaseURLis empty, the client derives it fromBaseURL, 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:BaseURLis the public issuer (https://socrate.example.com), so the derived URL ishttps://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.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.Changes:
docs/CLIENT-INTEGRATION.md:SOCRATE_ADMIN_BASE_URLin production.AdminBaseURL.README.md: theSOCRATE_ADMIN_BASE_URLrow in the env table.socrate/client.go: the package doc and theAdminBaseURLfield 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.sumleavesgo.sumunchangedgo build ./...passesgo vet ./...passesgo test -race -count=1 -timeout=120s ./...passesgolangci-lint run ./...reports 0 issuesgovulncheck ./...: not run locally (the sandbox can't reach vuln.go.dev); no dependency changed## [Unreleased]inCHANGELOG.mdCompatibility
🤖 Generated with Claude Code
https://claude.ai/code/session_01GKRxaeYxyDhmt42cehLsGA
Generated by Claude Code