72614e0844
The previous rewrite used NEXT_PUBLIC_API_URL (https://coop.hobokenchicken.com) as the destination. This created a loop through Caddy: /api/* → Next.js → rewrite to public URL → Caddy → Next.js → 502. Now routes /api/* and /webhooks/* directly to the Express backend on localhost:3001, bypassing Caddy entirely for API calls.
20 lines
424 B
JavaScript
20 lines
424 B
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
output: 'standalone',
|
|
allowedDevOrigins: ['172.20.1.238'],
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/api/:path*',
|
|
destination: 'http://localhost:3001/api/:path*',
|
|
},
|
|
{
|
|
source: '/webhooks/:path*',
|
|
destination: 'http://localhost:3001/webhooks/:path*',
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
module.exports = nextConfig;
|