aboutsummaryrefslogtreecommitdiff
path: root/communities/red-right-hand/174bg.net/src/proxy.js
diff options
context:
space:
mode:
Diffstat (limited to 'communities/red-right-hand/174bg.net/src/proxy.js')
-rw-r--r--communities/red-right-hand/174bg.net/src/proxy.js30
1 files changed, 0 insertions, 30 deletions
diff --git a/communities/red-right-hand/174bg.net/src/proxy.js b/communities/red-right-hand/174bg.net/src/proxy.js
deleted file mode 100644
index dc0fa42..0000000
--- a/communities/red-right-hand/174bg.net/src/proxy.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import { NextResponse } from "next/server";
-
-export async function proxy(request) {
- let session = null;
-
- try {
- 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
- }
-
- if (!session?.user) {
- const loginUrl = new URL("/login", request.url);
- loginUrl.searchParams.set("callbackUrl", request.nextUrl.pathname);
- return NextResponse.redirect(loginUrl);
- }
-
- return NextResponse.next();
-}
-
-export const config = {
- matcher: ["/secure/:path*"],
-};