App not connecting to backend server


I am experiencing an issue with my app that I believe someone may have already faced here. A couple a months ago I ran into some challenges with CORS. Through this forum I was able to fix that with a proxy in my ionic.config.json file.

Today I took my app to QA on multiple devices but none of them are able to hit the backend server. Am I supposed to remove the proxy before releasing the app? Could that be the reason why I am facing this issue? Everything works when testing on device connected to my laptop but not on standalone devices.

Please advise.


The proxy is provided by the Ionic CLI, ionic serve. If the app is running on a device, this doesn’t exist and will fail. You will have to replace your proxy URL with the original URLs again. Most probably CORS will not be a problem on the actual device (via ionic cordova build ios and ionic cordova build android) because it only applies to browser environments.

If it still doesn’t work, you can use remote debugging to find out why:
Follow these instructions here to debug the problem in Safari dev tools:
Follow these instructions here to debug the problem in Chrome dev tools:
Look at the console and network tabs for errors.

If it actually is a CORS issue on the device, you have to implement the headers in your backend to fix it. No other way then.

Thanks for the reply @Sujan12. I did some remote debugging and that is exactly what I found. Problem was resolved a couple of hours after I brought it to this forum. A lot of us are new to the frontend dev space. I must say Ionic and typescript have help greatly to bridge the gap. I am currently researching on the best way to manage app “properties” in ionic and would love to hear your recommendations.

1 Like

Open a new topic for that please - maybe someone else has the perfect answer for that. (I unfortunately don’t.)