diff --git a/.env b/.env index 601b1a1a..2272a516 100644 --- a/.env +++ b/.env @@ -25,3 +25,13 @@ MAIL_RECIPIENTS=marc@cablecreations.de,info@klz-cables.com PAYLOAD_DB_NAME=payload PAYLOAD_DB_USER=payload PAYLOAD_DB_PASSWORD=120in09oenaoinsd9iaidon + +# ──────────────────────────────────────────────────────────────────────────── +# Hetzner S3 Object Storage +# ──────────────────────────────────────────────────────────────────────────── +S3_ENDPOINT=https://fsn1.your-objectstorage.com +S3_ACCESS_KEY=ROB3MSWMEIGRL7N94ZKS +S3_SECRET_KEY=9QJV3NE8xeLxhyufhNU7lsUB0RffJxPhGuEuFSH3 +S3_BUCKET=mintel +S3_REGION=fsn1 +S3_PREFIX=klz-cables \ No newline at end of file diff --git a/proxy.ts b/middleware.ts similarity index 93% rename from proxy.ts rename to middleware.ts index 6fab20ea..2261faad 100644 --- a/proxy.ts +++ b/middleware.ts @@ -45,8 +45,10 @@ export default async function middleware(request: NextRequest) { if (internalHosts.includes(urlObj.hostname)) { const proto = headers.get('x-forwarded-proto') || 'https'; // Prioritize x-forwarded-host (passed by Traefik) over the local Host header - const hostHeader = - headers.get('x-forwarded-host') || headers.get('host') || 'testing.klz-cables.com'; + const fallbackHost = process.env.NEXT_PUBLIC_BASE_URL + ? new URL(process.env.NEXT_PUBLIC_BASE_URL).host + : 'klz-cables.com'; + const hostHeader = headers.get('x-forwarded-host') || headers.get('host') || fallbackHost; urlObj.protocol = proto;