在需要配置跨域的虚拟主机 vhosts文件中添加以下内容:
<Directory "D:/phpstudy_pro/WWW/cms-api/public">
Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Methods "GET, POST, PUT,DELETE,OPTIONS"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept,authorization"
#H

本文介绍了如何在Apache服务器上配置虚拟主机以解决CORS(跨源资源共享)问题。通过编辑vhosts文件并添加特定的配置段,可以允许不同源的请求访问资源。
217

被折叠的 条评论
为什么被折叠?



