Images are not loading from initial domain when using a cdn
Hello, i have a wordpress website on which i set the w3 total cache plugin with a cdn, the cdn is MaxCDN and is configured to not serve images but only css & js & font files. Because i configured the cdn not to serve images, the images in css files have the src as absolute path, path which point to original website domain, something like this: background-image: url("http://www.originaldomain.com/images/back.jpg");, the css file is served from the cdn like this: http://cdn.originaldomain.com/css/style.css . So the problem is that firefox refuse to load the images referred in style.css file, images which probably appear to be in another domain. If i try to load the images directly in browser, using address bar, they are loading ok, but on loading from css file i got a http error 500 (acording to firebug). The same website is loading ok in other browsers: ie7/ie8/ie9, opera, safari and chrome. Can anyone help me to solve the issue?
Gekose oplossing
I finally managed to fix the issue: the problem was a rewrite rule on .htaccess which redirected the request to a nonexistent file when the referer was not in the white list. The thing which pointed me on the wrong direction was the fact that other browsers happily displayed the images, probably by sending as referer the original domain name, not the cdn domain name, and so the rule was never kicking in for them. Thank you for support.
Lees dié antwoord in konteks 👍 1All Replies (6)
Disable W3cache for Admin and check it out...
Reload the webpage while bypassing the cache using one of the following steps:
- Hold down the Shift key and click the Reload button with a left click.
OR
- Press Ctrl + F5 or Ctrl + Shift + R (Windows and Linux)
- Press Command + Shift + R (Mac)
Let us know if this solves the issues you are having.
Hello, i already have a exception in w3 cache plugin for admin users (to bypass the cdn and use all files from original domain) so no problem there, the problem appear only for anonymous users, users which get the css files from cdn and the images should be loaded from original domain. Also i already tried the full page reload with no avail. The problem manifest only when the cdn is active and cdn is configured to not store website images, and appear to be something similar to same origin policy from javascript, i say this because checking in firebug i saw that the images which have as referer the cnd domain are not displayed. Thank you.
Try Firefox Safe Mode to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
(If you're not using it, switch to the Default theme.)
- You can open Firefox 4.0+ in Safe Mode by holding the Shift key when you open the Firefox desktop or Start menu shortcut.
- Or open the Help menu and click on the Restart with Add-ons Disabled... menu item while Firefox is running.
Once you get the pop-up, just select "'Start in Safe Mode"
If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to figure out which one. Please follow the Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems article for that.
To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.
When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.
Thank you.
Hello, the problem is still present in safe mode. I also tried on 2 openSUSE 11.4 installs with Firefox 19 and the behaviour is the same - the images from original domain are not loaded when the css file is provided by cdn.
You can check the Net log in the Web Console (Firefox/Tools > Web Developer;Ctrl+Shift+K).
Gekose oplossing
I finally managed to fix the issue: the problem was a rewrite rule on .htaccess which redirected the request to a nonexistent file when the referer was not in the white list. The thing which pointed me on the wrong direction was the fact that other browsers happily displayed the images, probably by sending as referer the original domain name, not the cdn domain name, and so the rule was never kicking in for them. Thank you for support.
Gewysig op