Prerequisites
🚀 Feature Proposal
I would like to have the possibility to validate the request payload before proxying it further.
E.g.
Currently, request.body in preHandler is a stream
.register(require('@fastify/http-proxy'), {
upstream: process.env.API,
prefix: '/v1/:domain/:apiKey',
rewritePrefix: '/full/:domain',
})
so I can't have something like this:
.register(require('@fastify/http-proxy'), {
upstream: process.env.API,
prefix: '/v1/:domain/:apiKey',
rewritePrefix: '/full/:domain',
preHandelr: (req) => { validate(req.body)}
})
Motivation
I have and rpc api which I'm proxying via http-proxy. I would like to check request json payload and restrict certain methods (not to proxy it further and reply with error)
I have no possibility to do so, since request.body is not parsed in preHander.
Example
No response
Prerequisites
🚀 Feature Proposal
I would like to have the possibility to validate the request payload before proxying it further.
E.g.
Currently,
request.bodyin preHandler is a streamso I can't have something like this:
Motivation
I have and rpc api which I'm proxying via http-proxy. I would like to check request json payload and restrict certain methods (not to proxy it further and reply with error)
I have no possibility to do so, since request.body is not parsed in preHander.
Example
No response