Ionic + Angular + Codeigniter4 CORS error in production

19 views Asked by At

I have the following issue. In my local environment I can make requests without any problems from my ionic + angular app to my php backend with codeigniter 4. But when I deploy to my Hostinger server it gives me CORS errors and the support is not able to solve it. Although I think it is a server problem, here I leave you my request and the controller to see if there is any error on my part.

I have already tried modifying the .htaccess, guidelines were added by the server's technical support and nothing has solved this problem.

1

There are 1 answers

1
StackoverBlows On

Hostinger server it gives me CORS errors and the support is not able to solve it.

I was able to add CORs to my Hostinger server as stated in their support docs: https://support.hostinger.com/en/articles/6320787-is-cors-supported-at-hostinger

You can use Cross-Origin Resource Sharing (CORS) on all of our Web, WordPress and Cloud hosting plans!

Just add the following lines to your website's .htaccess file:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>