diff --git a/src/client/components/modals/monitor/provider/http.tsx b/src/client/components/modals/monitor/provider/http.tsx index 3bbec75..34e7889 100644 --- a/src/client/components/modals/monitor/provider/http.tsx +++ b/src/client/components/modals/monitor/provider/http.tsx @@ -1,4 +1,4 @@ -import { Form, Input, Select } from 'antd'; +import { Form, Input, Select, Switch } from 'antd'; import React from 'react'; import { MonitorOverviewComponent, MonitorProvider } from './types'; import { trpc } from '../../../../api/trpc'; @@ -32,6 +32,13 @@ const MonitorHttp: React.FC = React.memo(() => { OPTIONS + + + = { run: async (monitor) => { if (typeof monitor.payload !== 'object') { @@ -24,6 +26,7 @@ export const http: MonitorProvider<{ contentType, bodyValue, maxRedirects, + ignoreTLS, } = monitor.payload; const config: AxiosRequestConfig = { @@ -45,9 +48,16 @@ export const http: MonitorProvider<{ config.data = bodyValue; } + const httpsAgentOptions = { + maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940) + rejectUnauthorized: !ignoreTLS, + }; + + config.httpsAgent = new https.Agent(httpsAgentOptions); + try { const startTime = dayjs(); - const res = await axios(config); + const res = await axios({ ...config }); const diff = dayjs().diff(startTime, 'ms');