0

EmberCLI を POW サーバーにプロキシするにはどうすればよいですか? 新しい明示的プロキシ ( https://github.com/stefanpenner/ember-cli/pull/1530 )で ember-cli master を使用しています。たとえば、これは機能しません。

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