• Resolved billson888

    (@billson888)


    I used Google Cloud CDN. I can remove CORS policy issue by adding /themes/…/*.woff2 or woff or ttf files into “Rejected files”. But it seem the “Rejected files” doesn’t work for /plugins/…/*.woff2 or woff or ttf file

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,

    Please add the following to your .htaccess file:

    <FilesMatch "\.(ttf|otf|eot|woff)$">
        <IfModule mod_headers.c>
            SetEnvIf Origin "http(s)?://(cdn|sub)\.domain\.com$" AccessControlAllowOrigin=$0
            Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
            Header merge Vary Origin
        </IfModule>
    </FilesMatch>

    Or if unsure where to add it, share your .htaccess file so we can modify it.

    Thread Starter billson888

    (@billson888)

    Hi Marko,

    I have modified to the following, but it seem the output is the same
    <FilesMatch “\.(ttf|otf|eot|woff|woff2)$”>
    <IfModule mod_headers.c>
    SetEnvIf Origin “http(s)?://cdn\.ua\.sugarproject\.com$” AccessControlAllowOrigin=$0
    Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    Header merge Vary Origin
    </IfModule>
    </FilesMatch>

    Thread Starter billson888

    (@billson888)

    Hi Marko,

    Can I use “Rejected files:” setting under CDN to fix this error? But it seem no effect too.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,

    The provided modified rule is correct. Tested and working as expected. There must be some other issues that need to be investigated. It looks like your CDN doesn’t add the CORS header to those files

    You can try using the follwing in “Rejected files:”
    {plugins_dir}/*.woff
    {plugins_dir}/*.woff2
    {plugins_dir}/*.ttf

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CORS policy issue with CDN’ is closed to new replies.