mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
Merge pull request #511 from singular0/no-ssl-cert-validation
Allow self-signed certificates for ping
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import https from 'https';
|
||||||
import { NextApiRequest, NextApiResponse } from 'next';
|
import { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
|
||||||
async function Get(req: NextApiRequest, res: NextApiResponse) {
|
async function Get(req: NextApiRequest, res: NextApiResponse) {
|
||||||
// Parse req.body as a ServiceItem
|
// Parse req.body as a ServiceItem
|
||||||
const { url } = req.query;
|
const { url } = req.query;
|
||||||
|
const agent = new https.Agent({ rejectUnauthorized: false });
|
||||||
await axios
|
await axios
|
||||||
.get(url as string)
|
.get(url as string, { httpsAgent: agent })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
res.status(response.status).json(response.statusText);
|
res.status(response.status).json(response.statusText);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user