【发布时间】:2015-09-18 06:16:51
【问题描述】:
Http-Proxy 和适配器一样,在我指定的代理目标的最后添加“/store-name”。
我想完全控制 URL,或者至少我应该能够为 url 添加后缀。
文件server/proxies/members.js 对我来说是这样的。
var proxyPath = '/members';
module.exports = function(app) {
// For options, see:
// https://github.com/nodejitsu/node-http-proxy
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=' });
});
};
由于最终的 url 是这种情况的样子
“http://localhost:8082/connection/testdb?tablename=/members/”
我想要
P.S.:类似于 "buildURL=url" ,可能在 http-proxy 中
【问题讨论】:
标签: ember.js cors ember-cli http-proxy node-http-proxy