fix(frontend): proxy /api to Express in dev; harden media file serving
- next.config: development-only rewrite /api/:path* to 127.0.0.1:4000; move sharp to experimental.serverComponentsExternalPackages for Next 14 - media/[id]/route: resolve storage at request time, fallbacks for backend/storage/media vs storage/media, async params, force-dynamic Made-with: Cursor
This commit is contained in:
@@ -1,15 +1,24 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
serverExternalPackages: ['sharp'],
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ['sharp'],
|
||||
},
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{ protocol: 'https', hostname: '**' },
|
||||
],
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
const rules = [
|
||||
{ source: '/calendar.ics', destination: '/calendar' },
|
||||
];
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
rules.push({
|
||||
source: '/api/:path*',
|
||||
destination: 'http://127.0.0.1:4000/api/:path*',
|
||||
});
|
||||
}
|
||||
return rules;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user