Ionic 4 proxy bug


#1

Hi, i have configured a proxy in the proxy.conf.json file and added it to angular.json.
If i serve the app everything works just fine, but if i use “ionic cordova run android -l” the proxy doesn’t work anymore.
Accually i been annoyed by a few problems like this since ionic 4, where diferents way or trying the app give very different results.
Any walkaround?


#2

As far as I know, as in v3, this proxy was never suppose to work while running cordova no? it was only intended to solve cors problem while running ionic serve


#3

I Don’t think so. If that’s true, I shouldn’t have cross origin messages


#4

Here, https://blog.ionicframework.com/handling-cors-issues-in-ionic/, it’s a ionic 3 article that explains that ionic serve and ionic run can give cors errors, so you have to use a proxy. As i said earlier, in Ionic 4 the proxy only works in ionic serve and when i run ionic cordova run the proxy doesn’t work and i have a CORS error :persevere:.

Ionic 4 is a cruel mistress!


#5

Thx for pointing out, I always and still only use the proxy for ionic serve assuming the rest should works as if I publish my app respectively without. Unfortunately I will not be able to help that much then. Maybe you could give a try adding @ionic/cli-plugin-proxy see https://ionicframework.com/docs/cli/configuring.html#using-a-proxy


#6

Unfortunately @ionic/cli-plugin-proxy doesn’t work either. In general i use ionic serve too, but i’m having a rought time with ionic serve and the ion refresher (Ionic 4 - Ion refresher bug) so i wanted to test the app on ionic run… what a pitty.
Even if i use ionic cordova run browser proxy get all messed up. Instead of http proxy-address/address-you-want, the app is trying of http localhost:8000/proxy-address/address-you-want


#7

:frowning:

Sorry no idea, only thing I could say is that the Angular proxy used in Ionic v4 for ionic serve just works fine, I could confirm that. For ionic run like I said above I don’t know. Good luck, let me know if you find a solution!


#8

Seems like the new Ionic cli version 4.3.0 solved the bug :slight_smile: