I can´t make request to the api i hosted here ERR_EMPTY_RESPONSE

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

Tried using https instead of http for the url_base?

More solutions:

  1. 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
  1. 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

1 Like

Thank you! :slight_smile: