lundi 14 mars 2016

EmberJs API Cors Domain nginx

I have an ember app that needs to communicate with an API server on another domain. I have my Ember app running via Nginx and need some help setting up a proxy.

Ember App -> data.myember.local
API Server -> http://ift.tt/1nJUfWU
Example Api call -> http://ift.tt/1U2rG5u

So in my nginx conf file I tried to setup the following

location ~^/Service/json/service/.* {
    valid_referers server_names;
    if ($invalid_referer) {
        return 403;
    }
    rewrite  ^/Service/json/service/(.*)$  /Service/json/service/$1 break;
    proxy_redirect off;
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_hide_header X-AspNet-Version;
    proxy_hide_header X-Powered-By;
    proxy_pass  $admin_host;
    proxy_max_temp_file_size 0;
    #proxy_intercept_errors  on;
}

When I go to the page and make where the API call is happening via EmberData, its showing that its trying to hit the api

data.myember.local/Service/json/service/treatments

Any thoughts on why is not replacing data.myember.local with myapi.domain.com?




Aucun commentaire:

Enregistrer un commentaire