fix: resolve SSL protocol error by using correct host header for analytics script
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user