I'm developing an app using ember-cli and it need to send http request to a server using a ProxyPass.
My server looks like this : subdomain.domain.com/api/clients/users and Ember-cli create by default http://localhost:4200/
I tried to do this in my http.conf :
ProxyPass /api/clients http://subdomain.domain.com/api/clients
This is working fine for http://localhost/api/clients, but I don't know how to make it works with a non standard port such as 4200.
I also try to create a virtualHost but it's the same :
<VirtualHost *:4200>
ProxyPass /api/clients http://subdomain.domain.com/api/clients
</VirtualHost>
How can I do that ?
[EDIT]: I set my RESTAdapter like this :
var ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api/clients'
});
During development, you should use an http-proxy generator to create a path to your API. ember help generate
lists the syntax:
http-proxy <local-path> <remote-url>
Generates a relative proxy to another server.
This generates a proxy that only exists during development (in /server/proxies/
), and is not compiled in a production build. This is likely what you're looking for, based on what you've provided above:
ember generate http-proxy api http://subdomain.domain.com
Ember uses node-http-proxy to create the proxy, so you can customize it more using that documentation if necessary.