fix: use NEXT_PUBLIC_APP_URL for agent enrolment install URL#254
Merged
Conversation
window.location.origin returns localhost when the UI is accessed via a local port-forward or proxy, producing install commands that agents cannot reach. Add a getAppOrigin() helper that prefers the new NEXT_PUBLIC_APP_URL env var so operators can set the real public-facing URL once and have it appear correctly in all generated curl commands. Falls back to window.location.origin so local dev requires no change. https://claude.ai/code/session_017G68coAiUoDTA9oAguxBKe
The existing AGENT_DOWNLOAD_BASE_URL variable (used by the ingest service and start.sh) is now also read by the web app server component and passed as a prop to AgentsSettingsClient, so the install command shown to users reflects the real public URL rather than whatever origin the browser happens to be using. Falls back to window.location.origin when the env var is not set, so local dev requires no change. https://claude.ai/code/session_017G68coAiUoDTA9oAguxBKe
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.
Summary
window.location.origin, so users accessing the app vialocalhost(e.g. a local port-forward or reverse proxy) would seelocalhostin the curl command — an address agents on other machines can't reach.getAppOrigin()helper inagents-client.tsxthat prefersNEXT_PUBLIC_APP_URLand falls back towindow.location.origin.NEXT_PUBLIC_APP_URLto.env.examplewith instructions.Test plan
NEXT_PUBLIC_APP_URL=https://infrawatch.example.comand verify enrolment token install commands show that URLhttps://claude.ai/code/session_017G68coAiUoDTA9oAguxBKe