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

This reverts commit d4edd432d8.
This commit is contained in:
shamoon 2023-09-09 06:07:04 -07:00 committed by GitHub
parent 4f1cde97ec
commit 95635fca04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 38 deletions

View file

@ -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,24 +25,20 @@ 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, {
method: "HEAD"
});
let endTime = performance.now();
if (status > 403) {
// try one more time as a GET in case HEAD is rejected for whatever reason
startTime = performance.now();
[status] = await httpProxy(pingURL);
endTime = performance.now();
}
return res.status(200).json({
status,
latency: endTime - startTime