ruby on rails - proxy ember cli to api host in production not working -
i'm using ember cli 0.1.3
front end , rails 4.1.8
backend. i'm using ember-simple-auth
authenticating users , followed https://github.com/givanse/ember-cli-simple-auth-devise set up.
it works great locally using ember server --proxy http://0.0.0.0:3000
cannot seem set proxy production environment.
i'm hosting both ember , rails apps on heroku. found there proxy generator ember cli used ember g http-proxy users http://"url"
this created servers/proxies/http:/url.js
:
var proxypath = '/users'; module.exports = function(app) { // options, see: // https://github.com/nodejitsu/node-http-proxy var proxy = require('http-proxy').createproxyserver({}); var path = require('path'); app.use(proxypath, function(req, res, next){ // include root path in proxied request req.url = path.join(proxypath, req.url); proxy.web(req, res, { target: 'http://url' }); }); };
now once pushed heroku, xhr request
still points the ember host.
ok turns out thinking way complicated had add whole url endpoint.
config/environment.js
env['simple-auth-devise'] = { servertokenendpoint: 'http://url/users/sign_in', crossoriginwhitelist: ['http://url/'] };
Comments
Post a Comment