I am trying to build a proxy server with fastify-http-proxy but my problem is I should able to update the dynamic URL in the upstream value
like this
http://localhost:3000/https://stackoverflow.com/
const Fastify = require('fastify')
const server = Fastify()
const proxy = require('fastify-http-proxy');
server.register(proxy, {
upstream: 'http://example.com',
undici: true,
preHandler: (request, reply, done) => {
let proxyUrl = request.url.substring(1);
console.log(proxyUrl) // How to set this url as upstream I am able to get https://stackoverflow.com but i don't know how to set that value in upstream
done()
}
})
How to set proxyUrl as upstream value