如何为Apache httpd服务器启用CORS? (分步过程)
问题描述:
我想知道是否有人可以帮助我在Apache Web服务器上设置CORS。我希望逐步执行此过程,因为许多在线站点都在告诉我不同的事情。就像我需要对httpd.conf或ssl.conf文件执行的操作,将.htaccess文件放在何处等。
I was wondering if anybody can help me set up CORS on my Apache web server. I would appreciate a step-by-step process because many sites online are telling me different things. Like what do I need to do on my httpd.conf or ssl.conf files, where to put my .htaccess file, etc.
任何帮助将不胜感激。谢谢!
Any help would be appreciated. Thanks!
答
# edit your conf/httpd.conf file. Verify that the headers module is loaded
LoadModule headers_module modules/mod_headers.so
# to whitelist every origin, use
Header set Access-Control-Allow-Origin "*"