|
1 | 1 | import { defineNuxtConfig } from 'nuxt/config' |
2 | 2 | import variables from './app/utilities/variables' |
3 | 3 |
|
| 4 | +if (!process.env.NUXT_BASE_URL) { |
| 5 | + throw new Error('NUXT_BASE_URL environment variable is required. Set it before running the build.') |
| 6 | +} |
| 7 | + |
4 | 8 | const SEO = { |
5 | 9 | TITLE: `Jack Domleo - ${variables.OCCUPATION}`, |
6 | 10 | DESCRIPTION: `Personal website of Jack Domleo, a ${variables.OCCUPATION.toLowerCase()} specialising in JavaScript-based technologies and web development.` |
7 | 11 | } |
8 | 12 |
|
9 | 13 | export default defineNuxtConfig({ |
10 | 14 | ssr: true, |
| 15 | + app: { |
| 16 | + head: { |
| 17 | + meta: [ |
| 18 | + { |
| 19 | + // Content-Security-Policy restricts which resources the browser is allowed to load. GitHub Pages does not support custom response headers, so this must be set as a <meta http-equiv> tag instead. Note: frame-ancestors is ignored by browsers when set via a meta tag (it only works as a response header), but all other directives are honoured. Key directives: |
| 20 | + // - default-src 'self' → block all resources not explicitly permitted |
| 21 | + // - script-src 'unsafe-inline' → required by Nuxt's inline hydration scripts |
| 22 | + // - style-src 'unsafe-inline' → required for Vue's scoped style injection |
| 23 | + // - frame-ancestors 'none' → prevents this page being embedded in an iframe (clickjacking) |
| 24 | + // - base-uri 'self' → prevents <base> tag hijacking |
| 25 | + // - form-action 'self' → prevents forms from submitting to external URLs |
| 26 | + 'http-equiv': 'Content-Security-Policy', |
| 27 | + content: "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; font-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" |
| 28 | + }, |
| 29 | + { |
| 30 | + // Referrer-Policy controls how much referrer information is sent with outbound requests. strict-origin-when-cross-origin: sends the full URL for same-origin requests, but only the origin (no path/query) for cross-origin requests, and nothing over HTTP. This prevents leaking page URLs to third-party services via the Referer header. |
| 31 | + name: 'referrer', |
| 32 | + content: 'strict-origin-when-cross-origin' |
| 33 | + } |
| 34 | + ] |
| 35 | + } |
| 36 | + }, |
11 | 37 | typescript: { |
12 | 38 | typeCheck: process.env.NODE_ENV === 'dev', |
13 | 39 | strict: true |
|
0 commit comments