SPB Git forge

spb/spb-cloud

Public
10commits 1branches 0releases
3.2 MBsize
maindefault branch
1 h agolast push
JavaScript 56.7% TypeScript 42.6%
1.6 KB · 50 lines javascript
Raw Blame History
1/** @type {import('next').NextConfig} */2const nextConfig = {3  experimental: {4    serverComponentsExternalPackages: ["bcryptjs"],5  },6  async headers() {7    const corsOrigin = process.env.CORS_ORIGIN || "*";8    const primaryOrigin = corsOrigin.includes(",") ? corsOrigin.split(",")[0].trim() : corsOrigin;9    return [10      {11        source: "/api/(.*)",12        headers: [13          { key: "Access-Control-Allow-Origin", value: primaryOrigin },14          { key: "Access-Control-Allow-Methods", value: "GET,POST,PUT,PATCH,DELETE,OPTIONS" },15          { key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization, x-csrf-token" },16          { key: "Access-Control-Allow-Credentials", value: "true" },17          { key: "Vary", value: "Origin" },18        ],19      },20      {21        source: "/(.*)",22        headers: [23          { key: "X-Content-Type-Options", value: "nosniff" },24          { key: "X-Frame-Options", value: "SAMEORIGIN" },25          { key: "X-XSS-Protection", value: "1; mode=block" },26          { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },27        ],28      },29      {30        source: "/pdf.worker.min.mjs",31        headers: [32          { key: "Content-Type", value: "application/javascript" },33        ],34      },35    ];36  },37  webpack: (config) => {38    config.resolve.alias.canvas = false;39    config.module.rules.push({40      test: /pdf\.mjs$/,41      include: /node_modules[\\/]pdfjs-dist/,42      type: "javascript/auto",43      resolve: { fullySpecified: false },44    });45    return config;46  },47};4849export default nextConfig;50