1

I am using CodeIgniter REST API with Angular frontend.

I tried to fetch and post data with REST API, but CORS error occurs in console, and I installed chrome CORS extension and enabled to solve the problem.

When I moved files to the remote host, same error occurs again.

Files hosted on a different server than the REST API.

for example:

frontend: http://frontend.com
RestApi:  http://ipaddress.com

I tried to enable the CORS in .htaccess and HTTP headers through PHP, to no avail.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
Surya
  • 11
  • 3
  • It may be that they use different ports. Sorry but I don’t know codeigniter so I don’t know how to help. Using different ports can cause CORS. – Matt Dec 01 '19 at 11:55
  • Does this answer your question? [CORS with php headers](https://stackoverflow.com/questions/8719276/cors-with-php-headers) – PsyGik Dec 10 '19 at 09:25

0 Answers0