Revert "Enhancement: forward cookies from request (#1804)" (#1946)

This reverts commit d4edd432d8.
pull/1955/head
shamoon 1 year ago committed by GitHub
parent 4f1cde97ec
commit 95635fca04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,6 @@ import { performance } from "perf_hooks";
import { getServiceItem } from "utils/config/service-helpers";
import createLogger from "utils/logger";
import { httpProxy } from "utils/proxy/http";
import {importCookieHeader} from "utils/proxy/cookie-jar";
const logger = createLogger("ping");
@ -26,10 +25,6 @@ export default async function handler(req, res) {
});
}
if (req.headers.cookie) {
importCookieHeader(pingURL, req.headers.cookie)
}
try {
let startTime = performance.now();
let [status] = await httpProxy(pingURL, {

@ -37,27 +37,3 @@ export function addCookieToJar(url, headers) {
cookieJar.setCookieSync(cookies[i], url.toString(), { ignoreError: true });
}
}
export function importCookieHeader(url, cookieHeader) {
const cookies = cookieHeader.split(';');
for (let i = 0; i < cookies.length; i += 1) {
const [key, value] = cookies[i].trim().split('=');
// If there's an existing cookie with a matching key for this url,
// we want to update it. Otherwise, we add a new cookie
let existingCookie;
try {
existingCookie = cookieJar.getCookiesSync(url).find(existing => existing.key === key);
} catch (e) {
console.debug(`Failed to get cookies for ${url}: ${e}`)
}
if (existingCookie) {
existingCookie.value = value;
} else {
cookieJar.setCookieSync(new Cookie({
key, value
}), url.toString(), { ignoreError: true });
}
}
}

@ -4,7 +4,6 @@ import validateWidgetData from "utils/proxy/validate-widget-data";
import { httpProxy } from "utils/proxy/http";
import createLogger from "utils/logger";
import widgets from "widgets/widgets";
import {importCookieHeader} from "utils/proxy/cookie-jar";
const logger = createLogger("genericProxyHandler");
@ -35,10 +34,6 @@ export default async function genericProxyHandler(req, res, map) {
params.body = req.body;
}
if (req.headers.cookie) {
importCookieHeader(url, req.headers.cookie)
}
const [status, contentType, data] = await httpProxy(url, params);
let resultData = data;

Loading…
Cancel
Save