jeudi 17 septembre 2015

how can i see/modify the final url that ember http-proxy hits

Http-Proxy, like adapter, adds "/store-name" at the last of the proxy target that I specify.
I want to have complete control of the URL ,or atleast I should be able to add suffix to the url.

The file server/proxies/members.js looks like this for me.

var proxyPath = '/members';

module.exports = function(app) {
// For options, see:
// http://ift.tt/SCiraL
var proxy = require('http-proxy').createProxyServer({});

proxy.on('error', function(err, req) {
console.error(err, req.url);
});

app.use(proxyPath, function(req, res, next){
// include root path in proxied request
req.url = proxyPath + '/' + req.url;
proxy.web(req, res, { target: 'http://localhost:8082/connection/testdb?tablename=' });
});
};

As the final url is this case looks like

"http://localhost:8082/connection/testdb?tablename=/members/"

instead i want

http://localhost:8082/connection/testdb?tablename=storename

P.S.: Is something like "buildURL=url" , possible in http-proxy




Aucun commentaire:

Enregistrer un commentaire