Enable CORS for Sketchfab Integration

Hi there, I am trying to enable CORS for sketchfab-integration in our homepage (we need CORS-enabled images to change texture files). I am following this tutorial and it works fine with the texture that he is hosting, but if we try to link our own it fails to load.
I have already tried and combined several solutions:

  • .htaccess: Header set Access-Control-Allow-Origin “*” as explained on enable-cors.org
  • setting headers in the kirby config.php as explained in the docs
  • manually setting it with PHP at the very top

…but nothing seems to work- this is the error message that we get:

Did I miss something in the settings? I hope you can help me out!

Thanks in advance!

Your serving the texture over HTTP but the origin is HTTPs. Have you tried serving the wood_albedo.jpg image over HTTPS? It is usually best not to mix protocols.

I’ve added the SketchFab embedded widget to pages before, without any issue. Is what your trying to do any different?

Just using the embed widget works fine, what we would like to achieve is changing the texture of the object, as seen here:
Sketchfab - changing textures
At the moment it is only working because I am not switchting between textures, but rather turning objects visible/invisible, which means a lot of additional geometry has to be uploaded to make that work. It would be much more efficient to only change the texture itself.

I also thought about serving it over HTTPs, but for example the texture from the tutorial is also working and not served over HTTPs. Here you can see the two cases, the texture from the tutorial URL is working without error:

Intresting, I havent done a huge amount with CORS but usual port of call for server tricks the .htaccess provided with the HTM5 Boilerplate. It’s full of awesome stuff. Try reading the comments and the articles supplied with them, the answer may lie there.

Sorry for my late reply - I just came back from holidays. Also thanks for your suggestion, but unfortunately I still haven’t managed to get it to work… I tried various boilerplate settings in combination with the other things that I mentioned before - still no success.

Have you ever tried to enable CORS for images on a Kirby-based site? I still think that there might be a Kirby setting that I’m missing.