Does CORS proxy workaround work for POSTs?

Greetings,

My app needs to make POST requests of a 3rd-party server with CORS restrictions in place. I’ve followed the example in this excellent blog post to set up an Ionic proxy so I can use “ionic serve”, but am still getting 404’s. I noticed that that example uses a GET, as do a couple others I’ve seen, and the people who are having trouble seem to be using POSTs. Is this a possibility?

If someone can confirm that the POST requests should work with the proxy, I’d be happy to post some code to help figure out the problem.

Any advice would be appreciated!

Thanks,
Jeff

Once you install the app to your mobile everything will work fine. This is a matter about the broswer, not related to native webviews. So if you are debugging on a browser, the best way to eliminate all the possible problems is to disable the web security and enable CORS for the browser.
Seriously, it may harm your computer if you visit websites but this method works so nice with me with chrome under mobile inspection both on windows and mac. All the $http method in angular works wonderfully even on browser testing without a ionic server (simply open the index.html).
Hope this helps.

Thanks! I turned on CORS in Chrome via the Allow-Control-Allow-Origin extension. It seems to be working better, but I have some other issues with my socket implementation that are getting in the way.

Once I’ve got that working, though, I bet this will be insanely helpful. I really didn’t want to lose the ability to “ionic serve” - the time it takes to emulate or run can take a big toll on a person’s workflow.

Thanks again,
Jeff

After some more experimentation, I’ve got a followup question for you. With CORS enabled, I’m trying to connect to the server and getting the following response:

A wildcard ‘*’ cannot be used in the ‘Access-Control-Allow-Origin’ header when the credentials flag is true. Origin ‘http://localhost:8100’ is therefore not allowed access.

Is that Credentials flag set on their server? I don’t have access to the code, but this seems like kind of a deal-breaker. Right?

Thanks,
Jeff

I have never met such error before,

Maybe this link can bring some help to you? Stackoverflow Question

Hello,
Did you find a solution ?

I haven’t had any problems with this in a couple of months, and am trying to remember what I did. :slight_smile: As I recall, it ended up being a problem with how I was accessing the URL - not a problem with Ionic itself. I needed to specify a different port, or a different protocol (https vs. http), that type of thing. I got this error again last week, and again it was because I’d forgotten to specify the correct port.

Are you seeing similar issues?