fix: resolve SSL protocol error by using correct host header for analytics script

This commit is contained in:
mstfyldz
2026-05-27 17:30:01 +03:00
parent a5951a97e9
commit e28fa966e3
2 changed files with 8 additions and 1 deletions

View File

@@ -5,7 +5,14 @@ import { NextRequest, NextResponse } from 'next/server'
// data-domain attribute'u ile domain belirtilir // data-domain attribute'u ile domain belirtilir
export async function GET(req: NextRequest) { 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 = ` const script = `
(function() { (function() {