You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the proxy to add a saml cookie and proxy on to a backend server. On response I want to forward the requested resource to the browser. It's working for all my xhr calls. But for some reason, when I request a html document it doesn't work. I get a status 200, but the browser never finishes loading and are stuck in "pending"
I looked at issue #97 but none of the solutions worked for me.
I've tried with both the decoded body and the gzipped one. Anyone have any ideas?
This is my onProxyRes function
function relayResponseHeaders(proxyRes, req, res) {
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
let originalBody = new Buffer('');
proxyRes.on('data', function(data) {
const bodyString = zlib.gunzipSync(data).toString('utf8')
originalBody = data
})
proxyRes.on('end', function() {
// forwarding source status
res.status(proxyRes.statusCode);
Object.keys(proxyRes.headers).forEach(function (key) {
res.append(key, proxyRes.headers[key]);
});
res.send(originalBody);
res.end();
// })
})
}
// run the proxy middleware based on the baseUri configuration
return proxy
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm using the proxy to add a saml cookie and proxy on to a backend server. On response I want to forward the requested resource to the browser. It's working for all my xhr calls. But for some reason, when I request a html document it doesn't work. I get a status 200, but the browser never finishes loading and are stuck in "pending"
I looked at issue #97 but none of the solutions worked for me.
I've tried with both the decoded body and the gzipped one. Anyone have any ideas?
This is my onProxyRes function
function relayResponseHeaders(proxyRes, req, res) {
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
}
// run the proxy middleware based on the baseUri configuration
return proxy
Beta Was this translation helpful? Give feedback.
All reactions