-
-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Description
I have a general question on how to call, if possible, the onResponse method from reply-from when using http-proxy. I am successful in calling rewriteHeaders but have not had luck with the onResponse call.
I am testing with an app generated with fastify-cli.
This is what I have.
fastify.register(proxy, {
upstream: 'myUrl',
prefix: '/apiProxy',
async beforeHandler(request, reply) {
console.log('beforeHandler from proxy called'); // works as expected
},
replyOptions: {
rewriteHeaders: headers => Object.assign({ 'x-from-proxy': 'yes-indeed' }, headers), // works as expected
onResponse: (res) => {
console.log('here'); // Should this work? Nothing is logged at this point.
},
},
});
I have tried a few iterations but wanted to know if this is a supported and (most likely) a syntax error.
I did post this in Gitter as well but my timing seems to be a bit off of when others are online (not trying to spam two places).
Any help is appreciated.
Metadata
Metadata
Assignees
Labels
No labels