Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ app.use('/api/v1/brokerPath/', (req, res, next) => {
res.status(resp.status).send(JSON.stringify(resp.data))
}).catch((error) => {
console.error(error);
res.status(error.response.status).send(error.response.data)
if(error.response){
res.status(error.response.status).send(error.response.data)
}else{
res.status(500).send(error.response?.data)
}
})
})

Expand Down Expand Up @@ -148,6 +152,11 @@ const onProxyRes = (proxyRes, req, res) => {
cfg.L.warn('proxy request failed with status ' + proxyRes.statusCode + ', url: \'' + proxyRes.req.host + proxyRes.req.path + '\'')
}

// set the response headers so that the frontend can decode the content
Object.keys(proxyRes.headers).forEach((key) => {
res.setHeader(key, proxyRes.headers[key]);
});

if (proxyRes?.headers?.location) {
const headers = req.headers;
const body = req.body;
Expand Down