0

laravel + php + apache + win7

error :

Access to XMLHttpRequest at 'http://api.demo.com' from origin 'http://demo.com' has been blocked by CORS policy: Request header field pragma is not allowed by Access-Control-Allow-Headers in preflight response.

config apache:


<VirtualHost *:80>

     DocumentRoot "G:/xampp/htdocs/demo/public"
     ServerName api.demo.com
     Header always set Access-Control-Allow-Origin "*"
     Header always add Access-Control-Allow-Methods "GET, POST"
     Header always set Access-Control-Allow-Headers "Origin,XMLHttpRequest, X-Requested-With, Content-Type, Authorization,X-Custom-Header"
     Header always set Access-Control-Allow-Credentials "true"

</VirtualHost>

but it still makes mistakes.why?

  • Does this answer your question? [How to allow Cross domain request in apache2](https://stackoverflow.com/questions/29150384/how-to-allow-cross-domain-request-in-apache2) – falinsky Apr 12 '20 at 12:58
  • Try the Headers set in this answer: https://stackoverflow.com/a/37228330/1768033 – Martin Cup Apr 12 '20 at 13:06

0 Answers0