Skip to content

fix: use NEXT_PUBLIC_APP_URL for agent enrolment install URL#254

Merged
simonjcarr merged 2 commits into
mainfrom
claude/fix-enrolment-url-env-JS3qR
Apr 18, 2026
Merged

fix: use NEXT_PUBLIC_APP_URL for agent enrolment install URL#254
simonjcarr merged 2 commits into
mainfrom
claude/fix-enrolment-url-env-JS3qR

Conversation

@simonjcarr
Copy link
Copy Markdown
Collaborator

Summary

  • The enrolment install URL shown in the UI was always built from window.location.origin, so users accessing the app via localhost (e.g. a local port-forward or reverse proxy) would see localhost in the curl command — an address agents on other machines can't reach.
  • Added a getAppOrigin() helper in agents-client.tsx that prefers NEXT_PUBLIC_APP_URL and falls back to window.location.origin.
  • Added NEXT_PUBLIC_APP_URL to .env.example with instructions.

Test plan

  • Set NEXT_PUBLIC_APP_URL=https://infrawatch.example.com and verify enrolment token install commands show that URL
  • Without the env var set, verify install commands still use the browser's current origin (no regression for local dev)
  • Check newly created tokens and existing tokens viewed via the token detail dialog both use the correct URL

https://claude.ai/code/session_017G68coAiUoDTA9oAguxBKe

claude added 2 commits April 17, 2026 23:23
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
@simonjcarr simonjcarr marked this pull request as ready for review April 18, 2026 07:12
@simonjcarr simonjcarr merged commit 295e27c into main Apr 18, 2026
8 checks passed
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