AbuAlone09 commited on
Commit
03232ae
·
verified ·
1 Parent(s): 47f2ebb

Update frontend/next.config.js

Browse files
Files changed (1) hide show
  1. frontend/next.config.js +2 -26
frontend/next.config.js CHANGED
@@ -2,18 +2,10 @@
2
  const nextConfig = {
3
  output: 'standalone',
4
  reactStrictMode: true,
5
- // Only set NEXT_PUBLIC_API_URL if explicitly provided
6
- // In Docker Space, we want it undefined so frontend uses relative URLs (proxied by Next.js)
7
- ...(process.env.NEXT_PUBLIC_API_URL && {
8
- env: {
9
- NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
10
- },
11
- }),
12
  async rewrites() {
13
- // In Docker Space, proxy /api/* requests to backend on port 8000
14
- // This allows frontend (7860) to communicate with backend (8000) internally
15
  const API_HOST = process.env.BACKEND_HOST || 'http://localhost:8000';
16
- console.log(`[Next.js] Setting up API proxy: /api/* -> ${API_HOST}/api/*`);
17
  return [
18
  {
19
  source: '/api/:path*',
@@ -25,22 +17,6 @@ const nextConfig = {
25
  },
26
  ];
27
  },
28
- }
29
-
30
- module.exports = nextConfig
31
-
32
- /** @type {import('next').NextConfig} */
33
- const nextConfig = {
34
- async rewrites() {
35
- return [
36
- {
37
- source: '/api/:path*',
38
- destination: 'http://localhost:8000/api/:path*',
39
- },
40
- ];
41
- },
42
  };
43
 
44
  module.exports = nextConfig;
45
-
46
-
 
2
  const nextConfig = {
3
  output: 'standalone',
4
  reactStrictMode: true,
5
+
6
+ // Proxy cấu hình để frontend nói chuyện với backend
 
 
 
 
 
7
  async rewrites() {
 
 
8
  const API_HOST = process.env.BACKEND_HOST || 'http://localhost:8000';
 
9
  return [
10
  {
11
  source: '/api/:path*',
 
17
  },
18
  ];
19
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  };
21
 
22
  module.exports = nextConfig;