Repository navigation
Expand file tree
/
Copy pathnext.config.ts
More file actions
44 lines (40 loc) · 1.67 KB
/
Copy pathnext.config.ts
File metadata and controls
44 lines (40 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { NextConfig } from 'next';
import { API_URL } from './lib/public-urls';
const apiOrigin = API_URL;
const csp = [
"default-src 'self'",
`script-src 'self' 'unsafe-inline' https://www.googletagmanager.com https://accounts.google.com https://challenges.cloudflare.com`,
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https:",
"font-src 'self' data:",
`connect-src 'self' ${apiOrigin} https://www.googleapis.com https://oauth2.googleapis.com https://accounts.google.com https://www.google-analytics.com https://challenges.cloudflare.com`,
"frame-src https://accounts.google.com https://challenges.cloudflare.com",
"media-src 'self' blob:",
"object-src 'none'",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
].join('; ');
const nextConfig: NextConfig = {
async headers() {
return [
{
source: '/:path*',
headers: [
{ key: 'Content-Security-Policy', value: csp },
{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains; preload' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'Permissions-Policy', value: 'geolocation=(), camera=(), microphone=(self)' },
{ key: 'Cross-Origin-Opener-Policy', value: 'same-origin-allow-popups' },
],
},
];
},
async rewrites() {
// Verificación de Search Console sin subir un archivo con token al repo.
return [{ source: '/google:token.txt', destination: '/api/gsc-verify?token=:token' }];
},
};
export default nextConfig;