diff --git a/README.md b/README.md index f0ebba2..ff79a5b 100644 --- a/README.md +++ b/README.md @@ -141,11 +141,11 @@ Images are automatically built and pushed to GitHub Container Registry (GHCR) on ### API Access -**Docker Compose**: Backend is on `http://localhost:5000`, frontend proxies API requests automatically. +**Docker Compose**: Backend is on `http://localhost:5000`, frontend on `http://localhost:3000` proxies API requests automatically. **Production Deployments**: Two options: 1. **Separate domains**: Set `NEXT_PUBLIC_API_URL` to backend URL (e.g., `https://api.example.com`) -2. **Single domain with proxy**: Set `NEXT_PUBLIC_API_URL=""` and `BACKEND_URL` to internal backend address. Access all routes through the frontend domain (e.g., `https://repo.example.com/auth/login`) +2. **Single domain with proxy**: Set `NEXT_PUBLIC_API_URL=""` and `BACKEND_URL` to internal backend address. The frontend proxies `/auth/*`, `/v1/*`, `/admin/*`, `/health`, and `/schema` routes to the backend. Access all routes through the frontend domain (e.g., `https://repo.example.com/auth/login`) ## Schema Configuration diff --git a/docs/CAPROVER.md b/docs/CAPROVER.md index 0efce62..fc72321 100644 --- a/docs/CAPROVER.md +++ b/docs/CAPROVER.md @@ -155,7 +155,7 @@ You should see a response about missing credentials (this is expected). NODE_ENV=production PORT=3000 ``` - This option allows the frontend to proxy `/auth/*`, `/api/*`, and `/v1/*` requests to the backend internally. + This option allows the frontend to proxy `/auth/*`, `/v1/*`, `/admin/*`, `/health`, and `/schema` requests to the backend internally. With this setup, users access everything through the frontend domain (e.g., `https://repo.wardcrew.com/auth/login`). **Important**: Replace `goodrepo-backend` with your actual backend app name in CapRover. diff --git a/frontend/next.config.js b/frontend/next.config.js index ae148b8..524f72c 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -3,13 +3,9 @@ const nextConfig = { output: 'standalone', async rewrites() { // Get backend URL from environment, fallback to localhost for development - const backendUrl = process.env.BACKEND_URL || 'http://backend:5000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:5000'; return [ - { - source: '/api/:path*', - destination: `${backendUrl}/:path*`, - }, { source: '/auth/:path*', destination: `${backendUrl}/auth/:path*`, @@ -18,6 +14,18 @@ const nextConfig = { source: '/v1/:path*', destination: `${backendUrl}/v1/:path*`, }, + { + source: '/admin/:path*', + destination: `${backendUrl}/admin/:path*`, + }, + { + source: '/health', + destination: `${backendUrl}/health`, + }, + { + source: '/schema', + destination: `${backendUrl}/schema`, + }, ]; }, }