I'm new in Apache server configuration, now I try to enable CORS.
With follow setting in httpd.conf, CORS can work properly.
<VirtualHost *:80>
DocumentRoot /var/www/html/
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
Header always set Access-Control-Allow-Origin "http://example.com"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Allow-Headers: "Content-Type"
</VirtualHost>
But current server always set Access-Control-Allow-xxx header to all coming request (Both Pre-flight OPTIONS request and actual request).
I only want to add Access-Control-Allow-xxx header for Pre-light request from setting origin (http://example.com), have any way to config for it?
I've read this question, and setenvif manual, but I can't find any option that I can extract Origin
info from the request.
I will be grateful for any help you can provide.