Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

cors-anywhere - 不同域的CORS ORIGIN问题(CORS ORIGIN issue with different domains)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...