proxy-middleware: just pass a string

This commit is contained in:
Girish Ramakrishnan
2024-07-30 12:04:35 +02:00
parent 5aa0c57a74
commit a5249102f2
3 changed files with 16 additions and 43 deletions
+1 -3
View File
@@ -33,9 +33,7 @@ function proxy(kind) {
req.url = url.format({ pathname: `/files/${id}/${encodeURIComponent(req.params[0])}`, query: parsedUrl.query }); // params[0] already contains leading '/'
const proxyOptions = url.parse(`http://${result.ip}:3000`);
proxyOptions.rejectUnauthorized = false;
const fileManagerProxy = middleware.proxy(proxyOptions);
const fileManagerProxy = middleware.proxy(`http://${result.ip}:3000`);
fileManagerProxy(req, res, function (error) {
if (!error) return; // note: response was already sent by proxy by this point