proxy-middleware: just pass a string
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -35,8 +35,7 @@ async function proxyToMailContainer(port, pathname, req, res, next) {
|
||||
parsedUrl.query['access_token'] = addonDetails.token;
|
||||
req.url = url.format({ pathname, query: parsedUrl.query });
|
||||
|
||||
const proxyOptions = url.parse(`http://${addonDetails.ip}:${port}`);
|
||||
const mailserverProxy = middleware.proxy(proxyOptions);
|
||||
const mailserverProxy = middleware.proxy(`http://${addonDetails.ip}:${port}`);
|
||||
|
||||
req.clearTimeout(); // TODO: add timeout to mail server proxy logic instead of this
|
||||
mailserverProxy(req, res, function (error) {
|
||||
|
||||
Reference in New Issue
Block a user