Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix: enforce HTTPS redirect globally in middleware
Gener962b0c462867
diff --git a/src/web/proxy.ts b/src/web/proxy.tsdeleted file mode 100644index 8eb7a7afa..000000000--- a/src/web/proxy.ts+++ /dev/null@@ -1,16 +0,0 @@-import { NextRequest, NextResponse } from "next/server";--export function proxy(req: NextRequest) {- const session = req.cookies.get("alook_session");- if (!session) {- return NextResponse.redirect(new URL("/login", req.url));- }- return NextResponse.next();-}--export const config = {- matcher: [- // Protect all (app) group routes but not /login, /api, or static assets- "/((?!login|auth|health|api|_next|favicon\\.ico|.*\\.).*)",- ],-};diff --git a/src/web/src/middleware.ts b/src/web/src/middleware.tsindex 0c4a19d36..2eece61c9 100644--- a/src/web/src/middleware.ts+++ b/src/web/src/middleware.ts@@ -3,16 +3,29 @@ import { getCloudflareContext } from "@opennextjs/cloudflare"import { createAuth } from "@/lib/auth"export async function middleware(request: NextRequest) {- const { env } = await getCloudflareContext({ async: true })- const auth = createAuth(env as Env)- const session = await auth.api.getSession({ headers: request.headers })+ if (+ request.headers.get("x-forwarded-proto") === "http" &&+ !request.nextUrl.hostname.startsWith("localhost") &&+ !request.nextUrl.hostname.startsWith("127.")+ ) {+ const httpsUrl = new URL(request.url)+ httpsUrl.protocol = "https:"+ return NextResponse.redirect(httpsUrl, 301)+ }++ if (request.nextUrl.pathname.startsWith("/dashboard")) {+ const { env } = await getCloudflareContext({ async: true })+ const auth = createAuth(env as Env)+ const session = await auth.api.getSession({ headers: request.headers })- if (!session) {- return NextResponse.redirect(new URL("/sign-in", request.url))+ if (!session) {+ return NextResponse.redirect(new URL("/sign-in", request.url))+ }}+return NextResponse.next()}export const config = {- matcher: ["/dashboard/:path*"],+ matcher: ["/((?!_next|favicon\\.ico|.*\\..*).*)"],}