rejetto / reverse-proxy

HFS plugin to proxy configured paths to other servers
GNU General Public License v3.0
0 stars 0 forks source link
hfs-plugin

reverse-proxy

HFS plugin to proxy configured paths to other servers

image

HFS ~ HTTP File Server https://github.com/rejetto/hfs

Messing with forwarded requests

On every forwarded request, this plugin is calling customApi reverseproxy_forward. If your code/plugin exports this customApi, you can interact with it.

exports.customApi =  {
    reverseproxy_forward({ forward, ctx }) {
        // here you can see and modify the request we are about to forward
        console.log(forward)
        // forward is an object { url, method, headers, body }
        // if you change its content, it will affect forwarded request.
    }
}