mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-24 07:21:09 -04:00
Handle cookies on redirection (#3589)
* feat: Set and send cookies on redirection (louislam#3587). * feat: Make proxy agents handle cookies * Merge package-lock.json * Merge package-lock.json * Fix lint --------- Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
parent
b8bd17ddbd
commit
80efe9b831
4 changed files with 69 additions and 15 deletions
|
@ -1,4 +1,3 @@
|
|||
const https = require("https");
|
||||
const dayjs = require("dayjs");
|
||||
const axios = require("axios");
|
||||
const { Prometheus } = require("../prometheus");
|
||||
|
@ -23,6 +22,8 @@ const jsonata = require("jsonata");
|
|||
const jwt = require("jsonwebtoken");
|
||||
const crypto = require("crypto");
|
||||
const { UptimeCalculator } = require("../uptime-calculator");
|
||||
const { CookieJar } = require("tough-cookie");
|
||||
const { HttpsCookieAgent } = require("http-cookie-agent/http");
|
||||
|
||||
const rootCertificates = rootCertificatesFingerprints();
|
||||
|
||||
|
@ -507,7 +508,12 @@ class Monitor extends BeanModel {
|
|||
}
|
||||
|
||||
if (!options.httpsAgent) {
|
||||
options.httpsAgent = new https.Agent(httpsAgentOptions);
|
||||
let jar = new CookieJar();
|
||||
let httpsCookieAgentOptions = {
|
||||
...httpsAgentOptions,
|
||||
cookies: { jar }
|
||||
};
|
||||
options.httpsAgent = new HttpsCookieAgent(httpsCookieAgentOptions);
|
||||
}
|
||||
|
||||
if (this.auth_method === "mtls") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue