Files
portifolio-evandrodevbr/next.config.ts
T
Evandro Fonseca Junior ad6a76efdd feat(config, layout, components): enhance security headers, improve SEO, and update project descriptions
- Added security headers in the Next.js configuration to enhance application security.
- Updated metadata in the layout component for improved SEO, including new titles, descriptions, and keywords.
- Introduced JSON-LD schema for projects to enhance search engine visibility.
- Enhanced project descriptions in the portfolio data for clarity and detail.
- Improved header component with logo integration and refined social media links for better accessibility.
2026-01-20 21:00:50 -03:00

105 lines
2.4 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,
},
// Otimizações de performance
experimental: {
scrollRestoration: true,
},
// Headers de cache e segurança
async headers(): Promise<
Array<{ source: string; headers: Array<{ key: string; value: string }> }>
> {
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=()",
},
];
// HSTS apenas em produção com HTTPS
if (process.env.NODE_ENV === "production") {
securityHeaders.push({
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains; preload",
});
}
return [
{
source: "/(.*)",
headers: securityHeaders,
},
{
source: "/static/(.*)",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
{
source: "/_next/image(.*)",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
];
},
// Proxy reverso para bypass de adblockers
async rewrites() {
return [
// Rybbit Analytics
{
source: "/analytics/:match*",
destination: "https://analytics.evandro.dev.br/:match*",
},
// Google Tag Manager - Script principal
{
source: "/gtm/js/:id",
destination: "https://www.googletagmanager.com/gtag/js?id=:id",
},
// Google Analytics - Endpoints de coleta
{
source: "/ga/:match*",
destination: "https://www.google-analytics.com/:match*",
},
// Google Analytics - Endpoint alternativo (g/collect)
{
source: "/g/:match*",
destination: "https://www.google-analytics.com/g/:match*",
},
];
},
// Compressão
compress: true,
};
export default nextConfig;