• Resolved johanna2patricia

    (@johanna2patricia)


    Hi Support,
    After the last update my Maxcdn isn’t working properly anymore.
    I talked to the support of Maxcdn and this is what they said:

    “W3 Total Cache adding CORS headers only to some of your webfont file types ( it doesn’t add it to woff2).
    Basically CORS ( Cross Origin Resource Sharing Headers ) are required to serve font files through a domain that’s not your website domain.
    In the recent W3TC update they’ve added the feature to add CORS headers, but forgot a file type, causing the issue you’re seeing now.
    What you can do is either reach out to W3 team or use another plugin to rewrite the URLs to CDN.
    This one: https://nl.www.ads-software.com/plugins/wp-cdn-rewrite/
    You can still keep W3TC, but you’d disable the CDN functionality.”

    So I have disabled the CDN functionality in W3 Total Cache now and will use this Rewrite plugin.
    But can you fix this, so that I can use the CDN option in W3 Total Cache again?
    Thanks.

    Johanna

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter johanna2patricia

    (@johanna2patricia)

    I searched on the net and found that I could also put some code in my .htaccess file.
    This code:

    # ----------------------------------------------------------------------
    # CORS-enabled images (@crossorigin)
    # ----------------------------------------------------------------------
    # Send CORS headers if browsers request them; enabled by default for images.
    # developer.mozilla.org/en/CORS_Enabled_Image
    # blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
    # hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
    # wiki.mozilla.org/Security/Reviews/crossoriginAttribute
    <IfModule mod_setenvif.c>
      <IfModule mod_headers.c>
        # mod_headers, y u no match by Content-Type?!
        <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
          SetEnvIf Origin ":" IS_CORS
          Header set Access-Control-Allow-Origin "*" env=IS_CORS
        </FilesMatch>
      </IfModule>
    </IfModule>
    # ----------------------------------------------------------------------
    # Webfont access
    # ----------------------------------------------------------------------
    # Allow access from all domains for webfonts.
    <IfModule mod_headers.c>
      <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
        Header set Access-Control-Allow-Origin "*"
      </FilesMatch>
    </IfModule>

    But that doesn’t solve it.

    I tried to use the Rewrite plugin, but that doesn’t grab all the images.
    So now I can’t use my Maxcdn anymore.
    Anybody has another solution?

    Johanna

    Thread Starter johanna2patricia

    (@johanna2patricia)

    I rolled back to a previous version of W3 Total Cache. That wasn’t easy and for 1 site it isn’t working ok. For the other site it is ok and I can use the Maxcdn again.
    What a nightmare this!

    Johanna

    Interesting issue I tend to stay away from using fonts in a CDN as I don’t like to use CORS but it will be noted. Glad you got it working \0

    Thread Starter johanna2patricia

    (@johanna2patricia)

    Hi Destac,
    Well it is n’t solved. 1 Site I did go back to W3 Total Cache 0.9.4.1 and there the Maxcdn is working.
    But the other site is a nightmare. I tried to rollback to a previous version, but I can’t use the Maxcdn then either.
    So I removed W3Total Cache from that site all together. But that is not what I really want.

    But you say you want to stay away from using fomts in a CDN. But how can you prevent that and get the CDN to work properly with W3 Total Cache?

    Thread Starter johanna2patricia

    (@johanna2patricia)

    Ok spoke too soon. The site that I thought was working with the CDN doesn’t work either.
    So now I have updated to W3 Total Cache 0.9.5 and disabled the Maxcdn. But that isn’t what I want.
    I hope somebody can fix this soon.

    Johanna

    Thread Starter johanna2patricia

    (@johanna2patricia)

    Ok solved now.
    Had great help from Maxcdn again and this is what he said and did:

    “I’ve disabled CORS on CDN side.
    Basically the issue is that you have CORS headers on your Origin already.
    So it isn’t necessary to be enabled on CDN side too :)”.

    So now all is working well with W3Total Cache 0.9.5.

    Johanna

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CORS Headers missing after update – CDN not working properly anymore’ is closed to new replies.