Fix public card URLs pointing to the API host instead of the card host#1
Open
dhve wants to merge 1 commit into
Open
Fix public card URLs pointing to the API host instead of the card host#1dhve wants to merge 1 commit into
dhve wants to merge 1 commit into
Conversation
Public agent cards are served from agentcards.host39.org, but the dashboard built URLs from NEXT_PUBLIC_HOST39_API_URL (host39.org), which Caddy routes to the Next.js app, so every copied or submitted card URL 404s. The server's PUBLIC_BASE_URL was also never set in prod, so /.well-known/ai-catalog.json and each card's _meta.publicUrl emitted http://localhost:3010. - web: add NEXT_PUBLIC_HOST39_CARDS_URL and use it as the public-URL base (falls back to the API URL for local dev), wired through the web Dockerfile and compose build args - server: set PUBLIC_BASE_URL in the prod and dev compose files plus .env examples - add the required DATABASE_URL to .env.example (documented non-Docker dev was crashing on a missing var) - run the dev compose as NODE_ENV=development (it was production, silently accepting the shipped default JWT secret) - README: document the new vars and correct the JWT_SECRET minimum length
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.
Problem
Public agent cards are served from
agentcards.host39.org, but the dashboard builds the public URL fromNEXT_PUBLIC_HOST39_API_URL(host39.org). In productionhost39.orgonly proxies/auth,/cards, and/.well-knownto the API; every other path (including/personal/<email>/<slug>.jsonand/<domain>/<slug>.json) is routed to the Next.js app. So the URL a user copies from the dashboard to submit to the NANDA Index returns the Next.js 404 page.Verified against the live deployment:
GET https://host39.org/personal/test@example.com/agent.json->404 text/html(Next.js)GET https://agentcards.host39.org/personal/test@example.com/agent.json->404 application/json(API)Separately, the server's
PUBLIC_BASE_URLis never set in the prod compose or.env.prod.example, so it falls back tohttp://localhost:3010. That value is baked into/.well-known/ai-catalog.jsonentries[].urland each card's_meta.publicUrl, so the Index would ingest localhost URLs.Changes
NEXT_PUBLIC_HOST39_CARDS_URLand use it as the base ingetPublicUrl, falling back to the API URL for local dev (where the API serves cards on the same origin). Wired throughweb/Dockerfileand both compose files.PUBLIC_BASE_URLindocker-compose.prod.yml,docker-compose.yml, and both.envexamples (https://agentcards.host39.orgin prod).DATABASE_URLto.env.exampleso the documented non-Docker dev flow (cp ../.env.example .env && npm run migrate) no longer fails on a missing var.NODE_ENV=development(it wasproduction, which silently accepts the shipped default JWT secret).JWT_SECRETminimum length (config enforces 16, the table said 32).Notes
The web app typechecks clean. Domain card paths on the live
agentcards.host39.orgcurrently 301-redirect; the repoCaddyfile.prodregex matches those paths correctly, so the deployed Caddy config may be out of sync with the repo (not changed here).