mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix(api): make cookie recognition during websocket connection more
robust
This commit is contained in:
committed by
Eli Bosley
parent
6bb3d55e3c
commit
2a82ea4765
@@ -87,7 +87,9 @@ export class GraphqlAuthGuard
|
|||||||
// parse cookies from raw headers on initial web socket connection request
|
// parse cookies from raw headers on initial web socket connection request
|
||||||
if (fullContext.connectionParams) {
|
if (fullContext.connectionParams) {
|
||||||
const rawHeaders = fullContext.req.extra.request.rawHeaders;
|
const rawHeaders = fullContext.req.extra.request.rawHeaders;
|
||||||
const headerIndex = rawHeaders.findIndex((headerOrValue) => headerOrValue === 'Cookie');
|
const headerIndex = rawHeaders.findIndex(
|
||||||
|
(headerOrValue) => headerOrValue.toLowerCase() === 'cookie'
|
||||||
|
);
|
||||||
const cookieString = rawHeaders[headerIndex + 1];
|
const cookieString = rawHeaders[headerIndex + 1];
|
||||||
request.cookies = parseCookies(cookieString);
|
request.cookies = parseCookies(cookieString);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user