aboutsummaryrefslogtreecommitdiff
path: root/communities/red-right-hand/174bg.net/src/middleware.js
diff options
context:
space:
mode:
Diffstat (limited to 'communities/red-right-hand/174bg.net/src/middleware.js')
-rw-r--r--communities/red-right-hand/174bg.net/src/middleware.js13
1 files changed, 6 insertions, 7 deletions
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