239 lines
7.0 KiB
JavaScript
239 lines
7.0 KiB
JavaScript
// next.config.js
|
|
//const withStyles = require("@webdeb/next-styles");
|
|
//const { nextI18NextRewrites } = require("next-i18next/rewrites");
|
|
const nextTranslate = require("next-translate-plugin");
|
|
const nextBuildId = require("next-build-id");
|
|
|
|
// module.exports = withStyles({
|
|
// sass: true, // use .scss files
|
|
// modules: true, // style.(m|module).css & style.(m|module).scss for module files
|
|
// sassLoaderOptions: {
|
|
// sassOptions: {
|
|
// includePaths: [
|
|
// "/styles/sass",
|
|
// "node_modules/govuk-frontend/govuk/all",
|
|
// "/styles/sass/patterns",
|
|
// "/styles/sass/welshgov",
|
|
// ], // @import 'variables'; # loads (src/styles/varialbes.scss), you got it..
|
|
// },
|
|
// },
|
|
// });
|
|
|
|
const securityHeaders = [
|
|
{
|
|
key: "X-DNS-Prefetch-Control",
|
|
value: "on",
|
|
},
|
|
{
|
|
key: "X-Frame-Options",
|
|
value: "SAMEORIGIN",
|
|
},
|
|
{
|
|
key: "X-Content-Type-Options",
|
|
value: "nosniff",
|
|
},
|
|
{
|
|
key: "X-Permitted-Cross-Domain-Policies",
|
|
value: "none",
|
|
},
|
|
{
|
|
key: "Referrer-Policy",
|
|
value: "origin-when-cross-origin", //no-referrer
|
|
},
|
|
{
|
|
key: "Strict-Transport-Security",
|
|
value: "max-age=63072000; includeSubDomains; preload",
|
|
},
|
|
{
|
|
key: "X-XSS-Protection",
|
|
value: "1; mode=block",
|
|
},
|
|
// {
|
|
// key: "Content-Security-Policy",
|
|
// value: "frame-src 'self'; child-src 'self';object-src 'none'; script-src 'self' 'https://www.googletagmanager.com' unsafe-inline",
|
|
// },
|
|
];
|
|
//const buildId = nextBuildId.sync({ dir: __dirname });
|
|
const buildId = Date.now().toString();
|
|
|
|
module.exports = {
|
|
//output: "standalone",
|
|
env: {
|
|
BUILD_ID_ENV: buildId,
|
|
},
|
|
swcMinify: false,
|
|
sassOptions: {
|
|
includePaths: [
|
|
"/styles/sass",
|
|
"node_modules/govuk-frontend/govuk/all",
|
|
"/styles/sass/patterns",
|
|
"/styles/sass/welshgov",
|
|
], // @import 'variables'; # loads (src/styles/varialbes.scss), you got it..
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
// Apply these headers to all routes in your application.
|
|
source: "/(.*)?",
|
|
headers: securityHeaders,
|
|
},
|
|
];
|
|
},
|
|
generateBuildId: () => buildId,
|
|
poweredByHeader: false,
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/ceisiadaudns",
|
|
destination: "/dnsapplications",
|
|
},
|
|
{
|
|
source: "/manyliondns",
|
|
destination: "/dnsdetails",
|
|
},
|
|
{
|
|
source: "/canlyniadauchwilio",
|
|
destination: "/searchresults",
|
|
},
|
|
{
|
|
source: "/fymhorth/canlyniadauchwilio",
|
|
destination: "/myportal/searchresults",
|
|
},
|
|
{
|
|
source: "/chwiliouwch",
|
|
destination: "/advancedsearch",
|
|
},
|
|
{
|
|
source: "/chwiliadcyfeiriadau",
|
|
destination: "/addresssearch",
|
|
},
|
|
{
|
|
source: "/fymhorth/chwiliouwch",
|
|
destination: "/myportal/advancedsearch",
|
|
},
|
|
{
|
|
source: "/fymhorth/chwiliadcyfeiriadau",
|
|
destination: "/myportal/addresssearch",
|
|
},
|
|
{
|
|
source: "/canlyniadauchwiliouwch",
|
|
destination: "/advancedsearchresults",
|
|
},
|
|
{
|
|
source: "/canlyniadaucyfeiriadau",
|
|
destination: "/addresssearchresults",
|
|
},
|
|
{
|
|
source: "/fymhorth/canlyniadauchwiliouwch",
|
|
destination: "/myportal/advancedsearchresults",
|
|
},
|
|
{
|
|
source: "/fymhorth/canlyniadaucyfeiriadau",
|
|
destination: "/myportal/addresssearchresults",
|
|
},
|
|
{
|
|
source: "/fymhorth",
|
|
destination: "/myportal",
|
|
},
|
|
{
|
|
source: "/achos",
|
|
destination: "/case",
|
|
},
|
|
{
|
|
source: "/achos/id/:slug",
|
|
destination: "/case/id/:slug",
|
|
},
|
|
{
|
|
source: "/fymhorth/achos",
|
|
destination: "/myportal/case",
|
|
},
|
|
{
|
|
source: "/fymhorth/achos/id/:slug",
|
|
destination: "/myportal/case/id/:slug",
|
|
},
|
|
{
|
|
source: "/fymhorth/achos/:slug",
|
|
destination: "/myportal/case/:slug",
|
|
},
|
|
{
|
|
source: "/fymhorth/gweldpopeth",
|
|
destination: "/myportal/viewall",
|
|
},
|
|
{
|
|
source: "/fymhorth/:slug",
|
|
destination: "/myportal/:slug",
|
|
},
|
|
{
|
|
source: "/fymhorth/cynrychiolaeth",
|
|
destination: "/myportal/representation",
|
|
},
|
|
{
|
|
source: "/manylionpellach",
|
|
destination: "/furtherdetails",
|
|
},
|
|
{
|
|
source: "/allgofnodi",
|
|
destination: "/logout",
|
|
},
|
|
{
|
|
source: "/apelnewydd",
|
|
destination: "/newappeal",
|
|
},
|
|
{
|
|
source: "/apelnewydd/:path*",
|
|
destination: "/newappeal/:path*",
|
|
},
|
|
{
|
|
source: "/cyfrif/cofrestr",
|
|
destination: "/account/register",
|
|
},
|
|
{
|
|
source: "/help/cwcis",
|
|
destination: "/help/cookies",
|
|
},
|
|
{
|
|
source: "/hygyrchedd",
|
|
destination: "/accessibility",
|
|
},
|
|
{
|
|
source: "/preifatrwydd",
|
|
destination: "/privacy",
|
|
},
|
|
{
|
|
source: "/manylion-am-gwcis",
|
|
destination: "/details-about-cookies",
|
|
},
|
|
{
|
|
source: "/telerau-ac-amodau",
|
|
destination: "/terms-and-conditions",
|
|
},
|
|
{
|
|
source: "/awd/mewngofnodi",
|
|
destination: "/auth/signin",
|
|
},
|
|
{
|
|
source: "/awd/mewngofnodi/ebost",
|
|
destination: "/auth/signin/email",
|
|
},
|
|
{
|
|
source: "/awd/gwall",
|
|
destination: "/auth/error",
|
|
},
|
|
{
|
|
source: "/awd/gwirio-cais",
|
|
destination: "/auth/verify-request",
|
|
},
|
|
{
|
|
source: "/cyfrif/cofrestr",
|
|
destination: "/account/register",
|
|
},
|
|
|
|
// {
|
|
// source: "/cy:path*",
|
|
// destination: "http://cyrmu.local/:path*",
|
|
// },
|
|
];
|
|
},
|
|
...nextTranslate(),
|
|
};
|