From c608a86046cd7b0e1a57da246ccc56a086bfb1ef Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Wed, 13 May 2026 17:08:14 +0100 Subject: fix middleware + remove prod --- communities/red-right-hand/174bg.net/src/middleware.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'communities/red-right-hand/174bg.net/src/middleware.js') diff --git a/communities/red-right-hand/174bg.net/src/middleware.js b/communities/red-right-hand/174bg.net/src/middleware.js index d9b9a6c..59312c6 100644 --- a/communities/red-right-hand/174bg.net/src/middleware.js +++ b/communities/red-right-hand/174bg.net/src/middleware.js @@ -4,14 +4,13 @@ export async function middleware(request) { let session = null; try { - const res = await fetch( - new URL("/api/auth/get-session", request.nextUrl.origin), - { - headers: { - cookie: request.headers.get("cookie") ?? "", - }, + const internalUrl = + process.env.BETTER_AUTH_URL_INTERNAL || "http://localhost:3000"; + const res = await fetch(new URL("/api/auth/get-session", internalUrl), { + headers: { + cookie: request.headers.get("cookie") ?? "", }, - ); + }); session = await res.json(); } catch { // If session check fails, treat as unauthenticated -- cgit v1.2.3