From d9b909bd7e0de57732ec4f610cfbccbec5c278c2 Mon Sep 17 00:00:00 2001 From: juanatsap Date: Wed, 12 Nov 2025 09:51:38 +0000 Subject: [PATCH] fix: restore rate limiting and fix language switch links Security: - Restore PDF endpoint rate limiting (3 requests/minute) - Keep security headers middleware (CSP, HSTS, X-Frame-Options) - Keep origin checker for PDF endpoint - Restore recovery and logger middleware Links: - Fix 'CV in [language]' links to use relative URLs (/?lang=) - Now correctly navigates to page instead of downloading - PDF download links remain as full URLs for direct download Simplifications: - Remove unused advanced middleware (not yet implemented) - Use simpler 2-parameter rate limiter constructor - Remove unused strconv import --- data/cv-en.json | 2 +- data/cv-es.json | 2 +- main.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/cv-en.json b/data/cv-en.json index 3277e15..12c9514 100644 --- a/data/cv-en.json +++ b/data/cv-en.json @@ -895,7 +895,7 @@ }, { "title": "Curriculum Vitae in PDF in Spanish", - "url": "https://juan.andres.morenorub.io/?lang=es", + "url": "/?lang=es", "type": "cv", "textBefore": "Curriculum Vitae in PDF in", "linkText": "Spanish" diff --git a/data/cv-es.json b/data/cv-es.json index bd37eee..bd17430 100644 --- a/data/cv-es.json +++ b/data/cv-es.json @@ -900,7 +900,7 @@ }, { "title": "Currículum Vitae en PDF en Inglés", - "url": "https://juan.andres.morenorub.io/?lang=en", + "url": "/?lang=en", "type": "cv", "textBefore": "Currículum Vitae en PDF en", "linkText": "Inglés" diff --git a/main.go b/main.go index 535439f..5b4568c 100644 --- a/main.go +++ b/main.go @@ -75,6 +75,7 @@ func main() { // Create rate limiter for PDF endpoint // Allow 3 PDF generations per minute per IP pdfRateLimiter := middleware.NewRateLimiter(3, 1*time.Minute) + log.Printf("🔒 Rate limiter enabled for PDF endpoint (3 requests/minute)") // Routes mux.HandleFunc("/", cvHandler.Home)