Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

Forward Set-Cookie and strip Bearer token

Edwin Jose15a6a3b13066
diff --git a/frontend/app/api/[...path]/route.ts b/frontend/app/api/[...path]/route.ts
index daa3147c8..1d0c5a126 100644
--- a/frontend/app/api/[...path]/route.ts
+++ b/frontend/app/api/[...path]/route.ts
@@ -116,6 +116,11 @@ async function proxyRequest(request: NextRequest, params: { path: string[] }) {
}
}
+ // Explicitly forward Set-Cookie headers (entries() may omit them)
+ for (const cookie of response.headers.getSetCookie()) {
+ responseHeaders.append("set-cookie", cookie);
+ }
+
// For streaming responses, pass the body directly without buffering
if (response.body) {
return new NextResponse(response.body, {
diff --git a/src/session_manager.py b/src/session_manager.py
index adbbb6b06..7c4dd3dda 100644
--- a/src/session_manager.py
+++ b/src/session_manager.py
@@ -217,8 +217,9 @@ class SessionManager:
def verify_token(self, token: str) -> Optional[Dict[str, Any]]:
"""Verify JWT token and return user info"""
try:
+ raw = token[7:] if token.startswith("Bearer ") else token
payload = jwt.decode(
- token,
+ raw,
self.public_key,
algorithms=[self.algorithm],
audience=["opensearch", "openrag"],