fix(web): remove API proxy, use direct backend requests
- Remove Next.js rewrites proxy configuration - Use NEXT_PUBLIC_API_URL for direct API requests - Fixes ECONNRESET errors from proxy failures Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5d39958913
commit
78543d7187
3 changed files with 6 additions and 12 deletions
|
|
@ -1 +1,4 @@
|
|||
# Frontend direct API request (browser-accessible)
|
||||
NEXT_PUBLIC_API_URL=https://api-dev.copilothub.ai
|
||||
# Core package still uses this
|
||||
MULTICA_API_URL=https://api-dev.copilothub.ai
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
// API Host
|
||||
export const API_HOST = process.env.NEXT_PUBLIC_API_HOST || '';
|
||||
// API Host - direct request to backend (no proxy)
|
||||
export const API_HOST = process.env.NEXT_PUBLIC_API_URL || process.env.NEXT_PUBLIC_API_HOST || '';
|
||||
|
|
|
|||
|
|
@ -2,16 +2,7 @@ import type { NextConfig } from "next";
|
|||
|
||||
const nextConfig: NextConfig = {
|
||||
transpilePackages: ["@multica/ui", "@multica/store", "@multica/hooks", "@multica/sdk"],
|
||||
rewrites: async () => {
|
||||
const apiUrl = process.env.MULTICA_API_URL;
|
||||
if (!apiUrl) return [];
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${apiUrl}/api/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
// Removed rewrites proxy - frontend requests API directly via NEXT_PUBLIC_API_URL
|
||||
headers: async () => [
|
||||
{
|
||||
source: "/sw.js",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue