XF 1.5 Apache, Access-Control-Allow-Origin for attachments

Rasmus Vind

Well-known member
Hey guys, I have worked several hours trying to get the Access-Control-Allow-Origin header to show up for attachments.

I am using friendly URLs.

I have tried the following:
Code:
    RewriteCond %{REQUEST_URI} ^/index.php/attachments
    RewriteRule .* - [E=CORS:1]

    Header set Access-Control-Allow-Origin "*" env=CORS

Code:
    RewriteCond %{REQUEST_URI} ^/attachments
    RewriteRule .* - [E=CORS:1]

    Header set Access-Control-Allow-Origin "*" env=CORS

Code:
    SetEnvIf Request_URI ^/attachments CORS

    Header set Access-Control-Allow-Origin "*" env=CORS

But none of them work. As far as I can see the Request_URI is only ever index.php as seen from the last rewrite rule in the standard htaccess.txt, but I don't understand how to fix this then.

Please advice.
 
Back
Top Bottom