Skip to content

Commit e7121dc

Browse files
committed
fix(proxy): update cookie path to ensure it is sent with all requests for improved API routing
1 parent cc4b12e commit e7121dc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/middleware/proxy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ const setUiCookie = (res, service) => {
139139
if (!res?.setHeader || !service) return;
140140
// Normalize service name: decode URL encoding, lowercase, replace spaces and forward slashes with underscores
141141
const normalized = decodeURIComponent(service).toLowerCase().replace(/\s+/g, '_').replace(/\//g, '_');
142-
// Use Path=/ui/ to restrict cookie to UI routes only, preventing interference with other pages
143-
const cookieValue = `${UI_SERVICE_COOKIE}=${normalized}; Path=/ui/; SameSite=Lax`;
142+
// Use Path=/ so cookie is sent with all requests (needed for ARR API routing and subrequests)
143+
const cookieValue = `${UI_SERVICE_COOKIE}=${normalized}; Path=/; SameSite=Lax`;
144144
const existing = res.getHeader('set-cookie');
145145
if (!existing) {
146146
res.setHeader('set-cookie', cookieValue);
@@ -450,7 +450,7 @@ export default defineEventHandler(async (event) => {
450450

451451
// Determine which service to use for API routing
452452
// Priority: cookie > cached service from session
453-
// Note: Cookie won't be sent for /api paths (Path=/ui/), so we rely on session cache
453+
// Both should be available, cookie is preferred as it's more reliable
454454
const apiRoutingService = cookieService || cachedService;
455455
const apiRoutingServiceType = cookieService ? cookieServiceType : cachedServiceType;
456456

0 commit comments

Comments
 (0)