Apache配置跨域

打开httpd.vhosts.conf

  
   DocumentRoot "D:\new\api\public"  
   ServerName api.lxb.cc
   "D:\new\api\public">  
       Options Indexes FollowSymLinks Includes ExecCGI  
       AllowOverride All  
       Require all granted
       Header set Access-Control-Allow-Origin *
       Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
       Header set Access-Control-Allow-Headers "Content-Type"
           

复制代码

在virtualhost中加入三个header即可。

转载于:https://juejin.im/post/5ca46187f265da30b8178bfe

你可能感兴趣的:(Apache配置跨域)