Reverse proxy with node-http-proxy - How to pass parameters via query string?

48 views
Skip to first unread message

Leo Baiano

unread,
Feb 26, 2019, 1:27:31 AM2/26/19
to nodejs
I have an application that loads a kibana dashboard inside an iframe, but I would not like to display the kibana URL and the parameters used to generate the filters in adshboard, through rison, in this iframe URL and to solve this I created another server and in it I'm using node-http-proxy to create the reverse proxy.

With the code below I can get my application to use https: // localhost: 8213 in the iframe and load the kibana

const target = 'https: //kibana.com .....';
const params = '/? params = example & params2 = test ....'
const proxy = httpProxy.createProxyServer ();
const server = https.createServer (options, function (req, res) {
    proxy.web (req, res, {
        target: target + params,
        secure: false,
        changeOrigin: true,
    });
});
server.listen (8213);

The problem is that the params are ignored, it only loads the target. I have already tested with a simpler URL to ensure that the problem is actually on the server with the reverse proxy and that it is actually ignoring what is passed via query string and taking into account only the host.

I imagine that maybe I have to pass the parameters through header, but I'm not finding any reference to this or I'm not sure how to search.
Reply all
Reply to author
Forward
0 new messages