mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-30 19:36:25 +02:00
feat: implement dynamic API proxying to FastAPI backend
- Added a new route handler for dynamic API requests, allowing proxying to the FastAPI backend. - Removed the previous rewrite configuration in next.config.ts for cleaner integration. - Updated .env.example to clarify backend URL usage.
This commit is contained in:
parent
e86d279d55
commit
9ecccc5403
3 changed files with 65 additions and 16 deletions
|
|
@ -44,21 +44,6 @@ const nextConfig: NextConfig = {
|
|||
},
|
||||
},
|
||||
|
||||
// Proxy /api/v1/* to the FastAPI backend. Keeps the real backend host
|
||||
// out of the client bundle. FASTAPI_BACKEND_INTERNAL_URL is server-only.
|
||||
async rewrites() {
|
||||
const target =
|
||||
process.env.FASTAPI_BACKEND_INTERNAL_URL ||
|
||||
process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL ||
|
||||
"http://localhost:8000";
|
||||
return [
|
||||
{
|
||||
source: "/api/v1/:path*",
|
||||
destination: `${target.replace(/\/+$/, "")}/api/v1/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
// Configure webpack (SVGR)
|
||||
webpack: (config) => {
|
||||
// SVGR: import *.svg as React components
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue