Ember-cli ProxyPass

I am developing an application using ember-cli and it needs to send an HTTP request to the server using ProxyPass.

My server looks like this: subdomain.domain.com/api/clients/users and Ember-cli creates http: // localhost: 4200 / by default

I tried to do this in my http.conf:

ProxyPass /api/clients http://subdomain.domain.com/api/clients

      

This works great for http: // localhost / api / clients , but I don't know how to get it to work on a non-standard port like 4200.

I am also trying to create a virtualHost, but it is the same:

<VirtualHost *:4200>
    ProxyPass /api/clients http://subdomain.domain.com/api/clients
</VirtualHost>

      

How can i do this?

[EDIT]: I set up my RESTAdapter like this:

var ApplicationAdapter = DS.RESTAdapter.extend({
    namespace: 'api/clients'
});

      

+3


source to share


1 answer


During development, you must use an HTTP proxy generator to generate the path to your API. ember help generate

lists the syntax:

http-proxy <local-path> <remote-url>
  Generates a relative proxy to another server.

      

This creates a proxy that only exists at design time (in /server/proxies/

) and does not compile in assembly. This is probably what you are looking for based on what you stated above:



ember generate http-proxy api http://subdomain.domain.com

      

Ember uses node-http-proxy to create a proxy, so you can configure it more efficiently using this documentation if needed.

+4


source







All Articles