0

如何让 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' });
  })

};
4

0 回答 0