apache 跨域问题处理

时间:2024-04-09 08:29:40

1.apache 配置 跨域问题解决方案   首先去掉 如图注释

apache 跨域问题处理

②设置对应的需要可以被跨域访问的服务   根据如图 配置相应的 所需的跨域规则  各个配置可以自己搜一下根绝所需配置

apache 跨域问题处理

<VirtualHost *:80>
    DocumentRoot "D:\install\phpstudy\PHPTutorial\WWW\crm\pc_release\apps"
    ServerName www.wx2.com
    Header set Access-Control-Allow-Origin *
    
Header set Access-Control-Allow-Credentials true
    
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, authorization"
    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PUT, DELETE, PATCH"
    ServerAlias
     
  <Directory "D:\install\phpstudy\PHPTutorial\WWW\crm\pc_release\apps">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
     Require all granted
  </Directory>
</VirtualHost>