Allow self-signed certificates for ping
This commit is contained in:
1 parent
a6694d81d8
commit
9ce569aabe
1 file changed
+3
-1
@@ -1,11 +1,13 @@
|
||||
import axios from 'axios';
|
||||
import https from 'https';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
async function Get(req: NextApiRequest, res: NextApiResponse) {
|
||||
// Parse req.body as a ServiceItem
|
||||
const { url } = req.query;
|
||||
const agent = new https.Agent({ rejectUnauthorized: false });
|
||||
await axios
|
||||
.get(url as string)
|
||||
.get(url as string, { httpsAgent: agent })
|
||||
.then((response) => {
|
||||
res.status(response.status).json(response.statusText);
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user