Replies: 1 comment
-
Think you could use onProxyRes: (proxyRes, req, res) => {
// log original request and proxied request info
const exchange = `[DEBUG] ${req.method} ${req.path} -> ${proxyRes.req.protocol}//${proxyRes.req.host}${proxyRes.req.path} [${proxyRes.statusCode}]`;
console.log(exchange); // [DEBUG] GET / -> http://www.example.com [200]
}), |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to get the final pathRewrite URL that gets sent to the target server? I'm using what I'd call a declarative syntax, preventing me from just calling console.log to get the final URL. If it helps, I'm providing the background of what I'm trying to do. I'd like to know if there's some place that I can call something like {
console.log('http-proxy-middleware res.targetUrl='+someObject.finalUrlAfterPathRewrite
}
Background: My middleware app is not forwarding properly and I'm getting errors like the ones below.
Please note, I already tried using DEBUG=express-http-proxy, but that didn't add any extra information. I wish to take the incoming request to localhost/spreadsheet-upload, add SSO type headers, pass that on to the spreadsheet-upload server, and return the results as if it went directly to the spreadsheet-upload.
The relevant route snippet is:
Beta Was this translation helpful? Give feedback.
All reactions