The current behavior:
All API requests to the localhost server are returning the index.html file of the React.js app on the iOS build, but requests work fine on browser and PWA builds.
The expected behavior:
Requests return the intended data (usually JSON)
Details
Typically, API requests go to localhost:5000/api/[route]. In the iOS build they are going to capacitor://localhost/api/[route]
Because the route is returning HTML and not JSON data, I am getting the following error (one of many, as each API route, has the same error) which causes a white screen:
TypeError: undefined is not a function (near '...a.map...')
I tried adding a hostname (location where the production server is hosted) to the capacitor.config.json file in my root directory, but it still fails. Dev API server is running on localhost:5000
How can I route my requests on the iOS build to direct to the correct location?