fix: use relative API URLs with Next.js proxy
This commit is contained in:
parent
df02bc9801
commit
c99a772b54
2 changed files with 4 additions and 7 deletions
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
import { VideoData } from './constants';
|
||||
|
||||
// Backend API base URL
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080/api';
|
||||
// Use relative URLs - Next.js rewrites will proxy to backend
|
||||
const API_BASE = '/api';
|
||||
|
||||
// Transform backend response to our VideoData format
|
||||
function transformVideo(item: any): VideoData {
|
||||
|
|
|
|||
|
|
@ -14,16 +14,13 @@ const nextConfig = {
|
|||
],
|
||||
},
|
||||
async rewrites() {
|
||||
const apiBase = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8080';
|
||||
// Backend runs on port 8080 inside the container
|
||||
const apiBase = 'http://localhost:8080';
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: `${apiBase}/api/:path*`,
|
||||
},
|
||||
{
|
||||
source: '/video_proxy',
|
||||
destination: `${apiBase}/video_proxy`,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue