The style of my website breaks when using SPAI, how can I solve this?

It is possible that, after installing ShortPixel Adaptive Images (SPAI), your website will appear unstyled from time to time. Here's an example of this behaviour:

This usually happens when you enable the option "Replace in CSS files" on SPAI's settings: Each time you clear the CSS cache in the plugin, or a new CSS file is requested to be served from the CDN, the CDN will do an initial redirect to the original CSS, so your site needs to send the proper HTTP header in order to let the browser know it's OK to load the original CSS redirected from 

  • If your website uses Apache or LiteSpeed, please add Header add Access-Control-Allow-Origin "*" to your .htaccess file. That's something our plugin is supposed to do by itself, but we've had cases where a manual edit was needed.
  • If, on the other hand, you use NGINX, please add location ~* \.(css|js|eot|otf|ttf|woff|woff2|svg)($|\?.*) { add_header Access-Control-Allow-Origin *; } to the NGINX configuration files.

If you need help adding the previous code snippets, please ask your hosting provider for assistance.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us