From f84f7aca7515516964b6757ac993ad35f6c23e77 Mon Sep 17 00:00:00 2001 From: TheGuyDanish <5776313+TheGuyDanish@users.noreply.github.com> Date: Sun, 11 Jul 2021 21:01:34 +0100 Subject: [PATCH] Introduce custom user agent. Fixes #5 Quick and easy fix. Could be improved by adding a version number as well. Like `Uptime-Kuma/0.0.1`, for example. --- server/model/monitor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 2735c378..b8e8eb30 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -71,7 +71,9 @@ class Monitor extends BeanModel { try { if (this.type === "http" || this.type === "keyword") { let startTime = dayjs().valueOf(); - let res = await axios.get(this.url) + let res = await axios.get(this.url, { + headers: { 'User-Agent':'Uptime-Kuma' } + }) bean.msg = `${res.status} - ${res.statusText}` bean.ping = dayjs().valueOf() - startTime;