Ember CLI代理到POW服务器

时间:2014-08-08 13:50:59

标签: ember.js proxy ember-cli node-http-proxy rack-pow

如何让EmberCLI代理POW服务器?我使用ember-cli master和新的显式代理(https://github.com/stefanpenner/ember-cli/pull/1530)。例如,这不起作用:

var Proxy = require('http-proxy');

// For options, see:
// https://github.com/nodejitsu/node-http-proxy
var proxy = Proxy.createProxyServer({});

module.exports = function(app) {

  app.use('/', function(req, res, next){
    proxy.web(req, res, { target: 'http://api.mywebsite.dev' });
  })

};

但是,如果我将目标更改为localhost,一切正常:

var Proxy = require('http-proxy');

// For options, see:
// https://github.com/nodejitsu/node-http-proxy
var proxy = Proxy.createProxyServer({});

module.exports = function(app) {

  app.use('/', function(req, res, next){
    proxy.web(req, res, { target: 'http://localhost:9292' });
  })

};

0 个答案:

没有答案