@hardboilr wrote:
Hi. I've read about service proxies at these places: ionic docs and ionic blog
My understanding is that a server proxy will intercept an outward request, then issue a new request to the API endpoint, thus effectively removing the origin-parameter from the request header, ex.
Origin : http://localhost:8100
(or something to that effect). This should allow a local client, to send requests to a server that do not allow CORS.Following the guidance, from the above mentioned sources, I'll have a setup looking like this:
ionic.project:
"proxies": [ { "path": "/api", "proxyUrl": "http://ionicbackend-plaul.rhcloud.com/api" } ],
app.js
myApp.constant('ApiEndpoint', { url: 'http://ionicbackend-plaul.rhcloud.com/api' });
$http({ method: 'POST', url: ApiEndpoint.url + '/friends/register/' + user.distance, data: user }).then(function (data)
When running the project:
ionic serve -l
, host and origin is this:Host: ionicbackend-plaul.rhcloud.com
Origin: http://localhost:8100
This, to my understanding, is not what I want. The proxy seems to be doing nothing right? Can you please provide some inputs as to what I might be doing wrong?
Posts: 1
Participants: 1