Post no working with --release tag, Please help me (Solved)


Hi, i cant get a Post to work in my build --prod --release app.
Everything works fine in browser and running with "ionic run cordova android"
But if i build the apk, sign and install i get a Forbbiden status from my request, and Gets to the same server are working in the apk.
I have started a debug mode in my server to see if cath what is wrong but i dont even thing that the request is beeing fired, my interceptor in the server dont cath nothing.
(Sorry for the english)


It was indeed a CORS problem, testing with “ionic serve” and “ionic run cordova --livereload” it creates a server in the browser and in the phone that make use of CORS. As my server was filtring all requests for CORS everything was working. When i build the project it didint make use of CORS, and the header origin was “Origin: file://” that was beeing rejected. I had alter my tomcat to accept that origin header and now it works, Thanks for the replys


Are you using the HTTP native plugin? My cordova plugins were not working either with the --release flag however it was on iOS


Im using HttpClient from Angular, i think the problem is CORS. When i run “ionic serve” or “ionic cordova run --livereload” the requests use CORS. but when i build the apk they dont, i dont know why, my TomCat server have a CORS filter and i think its blocking non-cors requests. (I have made a native app before and i works normally with my server)
I will take a look in the Native HTTP, thks


Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: Look at the console and network tabs for errors.