mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-02 08:09:44 +00:00
This PR completely removes Next.js image optimization from the login app
by replacing all next/image components with standard HTML <img> tags and
removing the image optimization configuration.
Closes https://github.com/zitadel/zitadel-charts/issues/381
# Which Problems Are Solved
Users were encountering issue when loading images in dedicated
environments. These happened due to nextjs imaging optimizations
creating different paths for images.
# How the Problems Are Solved
- Removed Next.js Image Optimization Config
- Removed images: { unoptimized: true } configuration from
[next.config.mjs](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)
This config was redundant since we no longer use next/image components
- Replaced next/image with standard <img> tags
(cherry picked from commit 0a31f4ba2b)
66 lines
1.5 KiB
JavaScript
Executable File
66 lines
1.5 KiB
JavaScript
Executable File
import createNextIntlPlugin from "next-intl/plugin";
|
|
import { DEFAULT_CSP } from "./constants/csp.js";
|
|
|
|
const withNextIntl = createNextIntlPlugin();
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
const secureHeaders = [
|
|
{
|
|
key: "Strict-Transport-Security",
|
|
value: "max-age=63072000; includeSubDomains; preload",
|
|
},
|
|
{
|
|
key: "Referrer-Policy",
|
|
value: "origin-when-cross-origin",
|
|
},
|
|
{
|
|
key: "X-Frame-Options",
|
|
value: "SAMEORIGIN",
|
|
},
|
|
{
|
|
key: "X-Content-Type-Options",
|
|
value: "nosniff",
|
|
},
|
|
{
|
|
key: "X-XSS-Protection",
|
|
value: "1; mode=block",
|
|
},
|
|
{
|
|
key: "Content-Security-Policy",
|
|
value: `${DEFAULT_CSP} frame-ancestors 'none'`,
|
|
},
|
|
{ key: "X-Frame-Options", value: "deny" },
|
|
];
|
|
|
|
const nextConfig = {
|
|
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
output: process.env.NEXT_OUTPUT_MODE || undefined,
|
|
reactStrictMode: true,
|
|
experimental: {
|
|
dynamicIO: true,
|
|
// Add React 19 compatibility optimizations
|
|
optimizePackageImports: ['@radix-ui/react-tooltip', '@heroicons/react'],
|
|
},
|
|
eslint: {
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
// Improve SSR stability - not actually needed for React 19 SSR issues
|
|
// onDemandEntries: {
|
|
// maxInactiveAge: 25 * 1000,
|
|
// pagesBufferLength: 2,
|
|
// },
|
|
// Better error handling for production builds
|
|
poweredByHeader: false,
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/:path*",
|
|
headers: secureHeaders,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default withNextIntl(nextConfig);
|