2026-04-23 15:33:11 +03:30
|
|
|
import type { NextConfig } from "next";
|
|
|
|
|
|
2026-05-03 20:15:39 +03:30
|
|
|
function publicAppHostname(): string | null {
|
|
|
|
|
const url = process.env.NEXT_PUBLIC_APP_URL;
|
|
|
|
|
if (!url) return null;
|
|
|
|
|
try {
|
|
|
|
|
return new URL(url).hostname;
|
|
|
|
|
} catch {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const appHost = publicAppHostname();
|
|
|
|
|
|
2026-04-23 15:33:11 +03:30
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
|
const nextConfig = {
|
|
|
|
|
// Enable React strict mode
|
|
|
|
|
reactStrictMode: true,
|
|
|
|
|
|
|
|
|
|
// Disable x-powered-by header for security
|
|
|
|
|
poweredByHeader: false,
|
|
|
|
|
|
2026-05-03 20:15:39 +03:30
|
|
|
// Configure allowed remote image sources (hostname derived from NEXT_PUBLIC_APP_URL at build time)
|
2026-04-23 15:33:11 +03:30
|
|
|
images: {
|
2026-05-03 20:15:39 +03:30
|
|
|
remotePatterns: [
|
|
|
|
|
{ protocol: "http", hostname: "localhost" },
|
|
|
|
|
...(appHost
|
|
|
|
|
? [
|
|
|
|
|
{ protocol: "http" as const, hostname: appHost },
|
|
|
|
|
{ protocol: "https" as const, hostname: appHost },
|
|
|
|
|
]
|
|
|
|
|
: []),
|
|
|
|
|
{ protocol: "https", hostname: "dyolink.com" },
|
|
|
|
|
{ protocol: "https", hostname: "www.dyolink.com" },
|
|
|
|
|
],
|
2026-04-23 15:33:11 +03:30
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Environment variables that will be available at build time
|
|
|
|
|
env: {
|
|
|
|
|
NEXT_PUBLIC_APP_NAME: process.env.NEXT_PUBLIC_APP_NAME,
|
|
|
|
|
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
|
|
|
|
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// Output configuration
|
|
|
|
|
output: 'standalone', // Reduces Docker image size
|
|
|
|
|
|
|
|
|
|
// Compress with gzip
|
|
|
|
|
compress: true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = nextConfig
|