90 lines
2.2 KiB
TypeScript
90 lines
2.2 KiB
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Otimização de imagens
|
|
images: {
|
|
formats: ["image/webp", "image/avif"],
|
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
|
minimumCacheTTL: 60,
|
|
},
|
|
|
|
turbopack: {
|
|
root: process.cwd(),
|
|
},
|
|
|
|
async redirects() {
|
|
return [
|
|
{
|
|
source: "/servicos/sob-medida",
|
|
destination: "/servicos/engenharia-de-software",
|
|
permanent: true,
|
|
},
|
|
];
|
|
},
|
|
|
|
async headers(): Promise<
|
|
Array<{ source: string; headers: Array<{ key: string; value: string }> }>
|
|
> {
|
|
const scriptSources = [
|
|
"'self'",
|
|
"'unsafe-inline'",
|
|
...(process.env.NODE_ENV === "production" ? [] : ["'unsafe-eval'"]),
|
|
"https://www.googletagmanager.com",
|
|
].join(" ");
|
|
const contentSecurityPolicy = [
|
|
"default-src 'self'",
|
|
`script-src ${scriptSources}`,
|
|
"connect-src 'self' https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com",
|
|
"img-src 'self' data: blob: https://*.google-analytics.com https://www.googletagmanager.com",
|
|
"style-src 'self' 'unsafe-inline'",
|
|
"font-src 'self' data:",
|
|
"frame-ancestors 'none'",
|
|
"object-src 'none'",
|
|
"base-uri 'self'",
|
|
"form-action 'self'",
|
|
].join("; ");
|
|
const securityHeaders = [
|
|
{
|
|
key: "X-Frame-Options",
|
|
value: "DENY",
|
|
},
|
|
{
|
|
key: "X-Content-Type-Options",
|
|
value: "nosniff",
|
|
},
|
|
{
|
|
key: "Referrer-Policy",
|
|
value: "strict-origin-when-cross-origin",
|
|
},
|
|
{
|
|
key: "Permissions-Policy",
|
|
value: "camera=(), microphone=(), geolocation=()",
|
|
},
|
|
{
|
|
key: "Content-Security-Policy-Report-Only",
|
|
value: contentSecurityPolicy,
|
|
},
|
|
];
|
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
securityHeaders.push({
|
|
key: "Strict-Transport-Security",
|
|
value: "max-age=31536000; includeSubDomains; preload",
|
|
});
|
|
}
|
|
|
|
return [
|
|
{
|
|
source: "/(.*)",
|
|
headers: securityHeaders,
|
|
},
|
|
];
|
|
},
|
|
|
|
// Compressão
|
|
compress: true,
|
|
};
|
|
|
|
export default nextConfig;
|