Opencart 3.0.3.2 + LiteSpeed Cache

#1
Hello, we were using Opencart 2 + LiteSpeed Cache it worked without problems.

Since we switched to the Opencart 3 version and we activate the LiteSpeed Web Server cache on our o2switch server - Activate the LSCache cache we lose the icons on the site. They are no longer loaded. As soon as we deactivate LiteSpeed Web Server the site works properly. We see this phenomenon on the native theme and on Journal3. (https://www.aquamagasin.com) There the site works with lscache disabled

Do you have an idea . Thanks for your help.
 
Last edited:
#2
In the development mode of my browser, console part, I have many CSP errors:

Content Security Policy: The source '' unsafe-inline '' present in script-src has been ignored: 'strict-dynamic' has been specified
Content Security Policy: The source "https:" present in script-src has been ignored: "strict-dynamic" has been specified
Content Security Policy: Source "http:" present in script-src has been ignored: "strict-dynamic" has been specified

Errors like this can block resources, including resources used to load icons.

There would be a CSP Opencart 3 policy problem ?
 
#4
Hello Unique_Eric, I used lscache-opencart3.0-V1.2.0.ocmod.zip and the latest lscache-opencart3.0-latest.ocmod.zip

The problem remains the same every time.
 
#6
Good evening.

I found the solution. I had to replace my htaccess us by that of the old version of the site which is tagged with Cpanel / comodo.

How is it that cpanel didn't tag the new one?

Everything works now.

# SEO URL Settings
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^robots.txt$ index.php?route=extension/feed/uksb_sitemaps/robots/ [L]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/uksb_sitemaps&store=0/ [L]
#RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTP_HOST} ^aquamagasin\.com$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "https\:\/\/www\.aquamagasin\.com\/" [R=301,L]
 
#7
In the end it doesn't work better. the problem still exists. it's incomprehensible. The same mistakes:

icomoon.ttf: 1 Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS
fontawesome-webfont.woff2: 1 Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS
icomoon.woff: 1 Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS
fontawesome-webfont.woff: 1 Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS
fontawesome-webfont.ttf: 1 Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS

While the live site without going through the cache everything works beautifully. No errors or redirection issues.
 
#8
It's really a crazy story.

To summarize :

With Template JOURNAL 3:

Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS fontawesome-webfont.woff2: 1
Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS fontawesome-webfont.woff: 1
Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS fontawesome-webfont.ttf: 1

Example of the offending url: /catalog/view/theme/journal3/icons/fonts/icomoon.woff?gzj9ot

With the native Template:

Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS fontawesome-webfont.woff: 1
Failed to load resource: net :: ERR_TOO_MANY_REDIRECTS fontawesome-webfont.ttf: 1

Example of the offending url:
/catalog/view/javascript/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0

We only get these errors when we activate Litespeed cache on our server with Cpanel.

No errors to report when we deactivate Litespeed cache

Our .htaccess :

Code:
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
Header always set Strict-Transport-Security "max-age=31536000"
</IfModule>

Options +SymLinksIfOwnerMatch

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines:
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On

# force https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP:X-Forwarded-SSL} =off

# force www
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s on(s)|offs()
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]

# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^robots.txt$ index.php?route=extension/feed/uksb_sitemaps/robots/ [L]
# RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/uksb_sitemaps&store=0/ [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]

<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  
  # Video
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/mpeg "access plus 1 year"

  # CSS, JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"

  # Others
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>


### LITESPEED_CACHE_START - Do not remove this line
<IfModule LiteSpeed>
CacheLookup on
## Uncomment the following directives if you has a separate mobile view
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC] RewriteRule .* - [E=Cache-Control:vary=ismobile]
</IfModule>
### LITESPEED_CACHE_END
We tried by commenting on several rules in the htaccess, we also tried with Header set Access-Control-Allow-Origin, no better ...

We cannot understand why we have these TOO_MANY_REDIRECTS only on web fonts and that on the 2 templates. Does it come from htaccess? A problem on Opencart?

I hesitate between a rope or a revolver ... Thanks for your help. Ohhhh help :)
 
#10
Opencart since this new version, and for security reasons, migrates its caches to the root of the / Home / mest8941 / storage server.

But storage, when installing the Opencart script and first created in / public_html / system / storage.
At the end of the installation, Opencart asks us to move storage to the root of the server, which is done either manually or automatically by Opencart. The first folder / public_html / system / storage must remain in place but the content cache is not emptied, which creates this conflict with / Home / mest8941 / storage

In short it works perfectly now and the icons are displayed correctly and for all this time that I made you lose another thousand excuses.
 

huso

New Member
#12
I'm having the same problem. (opencart v3 and journal theme) I read the end of the article 10 times, but I did not understand what to do. I think my English is not very good. help please
 
#14
I realized that my problem is different ... desktop caches show on mobile. creates confusion in the footer and header. i tried disabled
"LiteSpeed ESI Feature" and esi modüles all preferences.. what can i do? thanks
 

Unique_Eric

Administrator
Staff member
#15
Have you turn on the "Separate view for mobile Device" yet? If not, please enable it, and do a cache purge see if it helps. And please raise a new topic for different issue.
 
#16
Have you turn on the "Separate view for mobile Device" yet? If not, please enable it, and do a cache purge see if it helps. And please raise a new topic for different issue.
Hello!

I am facing the same problem, however I did not find within LiteSpeed the option "Separate view for mobile Device". Where can I find it?
 

serpent_driver

Well-Known Member
#19
I've just checked current version in plugin code. It seems LiteSpeed removed this setting, but language files still contains it. Wait for LiteSpeed staff or open a support ticket to ask why this setting has been removed.
 
Top