I am using CodeIgniter REST API with Angular frontend.
(我正在将CodeIgniter REST API与Angular前端一起使用。)
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.
(我尝试使用REST API提取和发布数据,但是控制台中发生CORS错误,我安装了chrome CORS扩展名并启用此功能来解决该问题。)
When I moved files to the remote host, same error occurs again.
(当我将文件移动到远程主机时,再次发生相同的错误。)
Files hosted on a different server than the REST API.
(托管在与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.
(我试图通过PHP在.htaccess
和HTTP标头中启用CORS ,但无济于事。)
ask by Surya translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…