<FilesMatch "\.(json|txt)$" >
SetEnvIf Origin "http(s)?://(www\.)?(sub.domain.com|sub2.domain.com|www.domain2.com)$" AccessControlAllowOrigin=$0$1
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
</FilesMatch>
If I use middle block on it's own (without FilesMatch) then it works and i can make my request. If I test my FilesMatch by putting Deny from all inside it then it clearly works as well. But put both of them together and I can't make the request. It seems to go thrum, but without credentials and throws out Access-Control-Allow-Origin warning.