fix(dev): proxy /api/nip05 and /api/ai in the Vite dev server
Both are production-only (Netlify Function + the CVM-host proxy), so on localhost the dev server answered them with index.html and the NIP-05 availability check showed 'Could not check right now' (and dev AI silently fell back to Pollinations). Proxying them to the real endpoints (as /api/mints already is) makes dev behave like prod. Verified: the check returns a real availability result and /api/ai/status returns the live Routstr balance. Dev-only config — the built output is unchanged, so the deploy guard skips it.
This commit is contained in:
parent
5f5a954ce6
commit
359a510c65
2 changed files with 20 additions and 0 deletions
|
|
@ -645,6 +645,12 @@ session with **no other memory of this project**. So:
|
|||
at `/api/mints/*` — prod proxies via `public/_redirects` (`/api/mints/* →
|
||||
https://mintradar.org/api/mints/:splat 200`), dev via `server.proxy` in
|
||||
`vite.config.ts`. Data is unofficial/rate-limited; adding a mint is native-only.
|
||||
⚠️ **`vite.config.ts`'s `server.proxy` also covers `/api/nip05` →
|
||||
`https://skate-spots.org` and `/api/ai` → `https://ai.skate-spots.org`
|
||||
(2026-09-28).** Without them the dev server answers those production-only
|
||||
endpoints with `index.html`, so the NIP-05 availability check showed
|
||||
**"Could not check right now"** on localhost and dev AI silently fell back to
|
||||
Pollinations. (Prod is unaffected — the functions are same-origin there.)
|
||||
⚠️ **Relative `/api/*` paths don't work in the native app** (fixed 2026-09-27):
|
||||
the shell is served from `https://localhost`, so `/api/mints/known` hits the
|
||||
LOCAL asset server and returns `index.html` → `Unexpected token '<' … not valid
|
||||
|
|
|
|||
|
|
@ -21,6 +21,20 @@ export default defineConfig(() => ({
|
|||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
// /api/nip05 (the name registry) and /api/ai are PRODUCTION-only (Netlify
|
||||
// Function + the CVM-host proxy). Without a dev proxy the dev server
|
||||
// answers them with index.html, so the NIP-05 availability check failed
|
||||
// locally with "Could not check right now" and dev AI never worked.
|
||||
'/api/nip05': {
|
||||
target: 'https://skate-spots.org',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
'/api/ai': {
|
||||
target: 'https://ai.skate-spots.org',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue