From 9097e2cead1809311684786cb133179b04eebf7c Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 12 Feb 2026 22:18:21 +0100 Subject: [PATCH] fix(infra): guaranteed Traefik bypass for OG images and sitemaps - Added explicit Host match and PathPrefixes to public router in docker-compose.yml. - Increased priority of public router to 2000. - Updated middleware.ts to bypass next-intl for OG images and API routes. - Verified local rendering of OG images. --- docker-compose.yml | 4 +- middleware.ts | 4 +- public/fonts/Inter-Bold.ttf | 1449 ++++++++++++++++++++++++++++++++ public/fonts/Inter-Regular.ttf | 1449 ++++++++++++++++++++++++++++++++ 4 files changed, 2903 insertions(+), 3 deletions(-) create mode 100644 public/fonts/Inter-Bold.ttf create mode 100644 public/fonts/Inter-Regular.ttf diff --git a/docker-compose.yml b/docker-compose.yml index 11d6a49f..4ddb7a5a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,13 +22,13 @@ services: - "traefik.http.routers.${PROJECT_NAME:-klz-cables}.middlewares=${AUTH_MIDDLEWARE:-${PROJECT_NAME:-klz-cables}-ratelimit,${PROJECT_NAME:-klz-cables}-forward,${PROJECT_NAME:-klz-cables}-compress}" # Public Router (Whitelist for OG Images, Sitemaps, Health) - - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=PathPrefix(`/health`, `/sitemap.xml`, `/robots.txt`, `/manifest.webmanifest`) || PathRegexp(`.*api/og/.*`) || PathRegexp(`.*opengraph-image$`) || PathRegexp(`.*opengraph-image\\?.*`)" + - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=(${TRAEFIK_HOST_RULE:-Host(`klz-cables.com`)}) && (PathPrefix(`/health`, `/sitemap.xml`, `/robots.txt`, `/manifest.webmanifest`, `/api/og`) || PathPrefix(`/de/opengraph-image`, `/en/opengraph-image`, `/de/blog/opengraph-image`, `/en/blog/opengraph-image`, `/de/products/opengraph-image`, `/en/products/opengraph-image`) || PathRegexp(`^/.*opengraph-image.*$`))" - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.entrypoints=websecure" - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=le" - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=true" - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.service=${PROJECT_NAME:-klz-cables}" - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.middlewares=${AUTH_MIDDLEWARE_UNPROTECTED:-${PROJECT_NAME:-klz-cables}-ratelimit,${PROJECT_NAME:-klz-cables}-forward,${PROJECT_NAME:-klz-cables}-compress}" - - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.priority=1000" + - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.priority=2000" - "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.port=3000" - "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.scheme=http" diff --git a/middleware.ts b/middleware.ts index 2084f262..1326aa6d 100644 --- a/middleware.ts +++ b/middleware.ts @@ -18,7 +18,9 @@ export default function middleware(request: NextRequest) { if ( pathname.startsWith('/stats') || pathname.startsWith('/errors') || - pathname.startsWith('/health') + pathname.startsWith('/health') || + pathname.startsWith('/api/og') || + pathname.includes('opengraph-image') ) { return; } diff --git a/public/fonts/Inter-Bold.ttf b/public/fonts/Inter-Bold.ttf new file mode 100644 index 00000000..7ace8885 --- /dev/null +++ b/public/fonts/Inter-Bold.ttf @@ -0,0 +1,1449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page not found · GitHub · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + +
+
+ +
+
+ 404 “This is not the web page you are looking for” + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + diff --git a/public/fonts/Inter-Regular.ttf b/public/fonts/Inter-Regular.ttf new file mode 100644 index 00000000..9a35886f --- /dev/null +++ b/public/fonts/Inter-Regular.ttf @@ -0,0 +1,1449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page not found · GitHub · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + +
+
+ +
+
+ 404 “This is not the web page you are looking for” + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +