Fix CORS: add proxy support for browser-based API calls on git-pages
Deploy to git-pages / deploy (push) Successful in 20s
Deploy to git-pages / deploy (push) Successful in 20s
- Add VITE_PROXY_URL env var to route requests through a CORS proxy when deployed as static site (CRDC API doesn't send Access-Control-Allow-Origin) - Update useApi.js, LoadingAnimation.jsx, and ChartPanel.jsx to respect proxy - Add nginx.conf with /api/v1/ reverse proxy + CORS headers for Docker deployment - Include proxy.php — simple PHP CORS proxy for git-pages hosts that support PHP - Document CORS workaround in README Without this fix, browser fetch() calls are blocked by same-origin policy and the app shows a blank white screen despite serving correct HTML.
This commit is contained in:
@@ -32,6 +32,7 @@ jobs:
|
||||
run: |
|
||||
npm ci
|
||||
# VITE_API_BASE defaults to the production API; override if needed via secrets.
|
||||
# For git-pages deployment, CORS is handled by setting up a proxy endpoint on the server.
|
||||
npm run build
|
||||
|
||||
- name: Publish dist/ to pages branch
|
||||
|
||||
Reference in New Issue
Block a user