I´m making an Ionic app, all works fine when i perform the request from postman, but when i use my app i can´t receive any response. I saw somebody on stackoverflow with the same problem and he said there were problems with 000webhost and they fixed it 3 weeks later.
Possibly, give us more context:
- The code that does the request
- What you have tried to fix your issue
The code is very simple and there wasn´t any problem when my server was running locally.
I thought it could be a CORS problem but I don´t think so since I perform the request from an android application.
This is my .htaccess
https instead of
http for the url_base?
- In CMD, type the following (if you’re on Windows) one by one, and press Enter after each addition.
ipconfig /release ipconfig /all ipconfig /flushdns ipconfig /renew netsh int ip set dns netsh winsock reset
- Use a VPN
It´s not working but i found a solution, I had to use the cordova´s http advanced plugin and put the following headers:
this.http_advanced.setSSLCertMode('nocheck'); this.http_advanced.setHeader('*', 'Access-Control-Allow-Origin' , '*'); this.http_advanced.setHeader('*', 'Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT'); this.http_advanced.setHeader('*', 'Accept','application/json'); this.http_advanced.setHeader('*', 'content-type','application/json'); this.http_advanced.setDataSerializer('json');
I leave all the code just in case somebody have the same problem with ionic on the future