const createNextIntlPlugin = require('next-intl/plugin');

/** @type {import('next').NextConfig} */
const nextConfig = {
    // Possible options:
    // - `undefined`: The default build output, `.next` directory, that works with production mode `next start` or a hosting provider like Vercel
    // - `'standalone'`: A standalone build output, `.next/standalone` directory, that only includes necessary files/dependencies. Useful for self-hosting in a Docker container.
    // - `'export'`: An exported build output, `out` directory, that only includes static HTML/CSS/JS. Useful for self-hosting without a Node.js server.
    output: "standalone", // needed for running the app in a Docker container
    experimental: {
       // "x-forwarded-host" is a HTTP header added by a reverse proxy,
       // and it contains the original host requested by the client
       // this is needed for the server to know which host to render
       // This however differs from the "Host" header, which results in
       // server rejecting API requests from the client
       // So here we tell Next.JS to accept requests  where the "x-forwarded-host" equals and of the following values
       serverActions: { allowedOrigins: ["rezije.app", "rezije.app:80", "localhost:3001", "0.0.0.0:80"], }
   }
};

const withNextIntl = createNextIntlPlugin('./app/i18n.ts');
 
const nextConfigIntl = withNextIntl(nextConfig);

module.exports = nextConfigIntl;