Fix: Fix no certificate caused by session reuse
This commit is contained in:
parent
7b8459c73a
commit
db26b7d123
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
const https = require('https');
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
var timezone = require('dayjs/plugin/timezone')
|
var timezone = require('dayjs/plugin/timezone')
|
||||||
|
@ -11,6 +12,12 @@ const {R} = require("redbean-node");
|
||||||
const {BeanModel} = require("redbean-node/dist/bean-model");
|
const {BeanModel} = require("redbean-node/dist/bean-model");
|
||||||
const {Notification} = require("../notification")
|
const {Notification} = require("../notification")
|
||||||
|
|
||||||
|
// Use Custom agent to disable session reuse
|
||||||
|
// https://github.com/nodejs/node/issues/3940
|
||||||
|
const customAgent = new https.Agent({
|
||||||
|
maxCachedSessions: 0
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status:
|
* status:
|
||||||
* 0 = DOWN
|
* 0 = DOWN
|
||||||
|
@ -75,8 +82,9 @@ class Monitor extends BeanModel {
|
||||||
if (this.type === "http" || this.type === "keyword") {
|
if (this.type === "http" || this.type === "keyword") {
|
||||||
let startTime = dayjs().valueOf();
|
let startTime = dayjs().valueOf();
|
||||||
let res = await axios.get(this.url, {
|
let res = await axios.get(this.url, {
|
||||||
headers: { 'User-Agent':'Uptime-Kuma' }
|
headers: { "User-Agent": "Uptime-Kuma" },
|
||||||
})
|
httpsAgent: customAgent,
|
||||||
|
});
|
||||||
bean.msg = `${res.status} - ${res.statusText}`
|
bean.msg = `${res.status} - ${res.statusText}`
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue