From e28fa966e3c7f24dc6350ef647464f44854cafc9 Mon Sep 17 00:00:00 2001 From: mstfyldz Date: Wed, 27 May 2026 17:30:01 +0300 Subject: [PATCH] fix: resolve SSL protocol error by using correct host header for analytics script --- config.json => config.json.bak | 0 src/app/api/analytics/script/route.ts | 9 ++++++++- 2 files changed, 8 insertions(+), 1 deletion(-) rename config.json => config.json.bak (100%) diff --git a/config.json b/config.json.bak similarity index 100% rename from config.json rename to config.json.bak diff --git a/src/app/api/analytics/script/route.ts b/src/app/api/analytics/script/route.ts index 81748a7..46902c0 100644 --- a/src/app/api/analytics/script/route.ts +++ b/src/app/api/analytics/script/route.ts @@ -5,7 +5,14 @@ import { NextRequest, NextResponse } from 'next/server' // data-domain attribute'u ile domain belirtilir export async function GET(req: NextRequest) { - const panelUrl = req.nextUrl.origin + const forwardedHost = req.headers.get('x-forwarded-host') + const hostHeader = req.headers.get('host') + const host = forwardedHost || hostHeader || req.nextUrl.host + + const forwardedProto = req.headers.get('x-forwarded-proto') + const protocol = forwardedProto || (host.includes('localhost') ? 'http' : 'https') + + const panelUrl = `${protocol}://${host}` const script = ` (function() {