Describe the issue or problem
At certain pages and in a kind of random way, the lang switcher of my theme is not working.
When I disable the local cache, the lang switcher works as expected.
Given it seems that you are using a child theme from Default Theme, could you please test on a local installation whether enabling the Default Theme also results on the same issue?
Sorry for my silence. Multiple fronts and only two hands.
I couldn’t reproduce the issue with the default theme (this is quite random)… but I found a related extra issue with the backend… when I try to “logout As” after an impersonation (ojs don’t logout and keep you with the secondary user).
As far as the problem disappears in the moment I disable browser’s cache I recalled when I made last changes related with this… and (I think) it emerged when I started to optimize apache performance applying the following rules:
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
# Expires Headers - 2678400s = 31 days
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType image/gif "access plus 2678400 seconds"
ExpiresByType image/jpeg "access plus 2678400 seconds"
ExpiresByType image/png "access plus 2678400 seconds"
ExpiresByType text/css "access plus 518400 seconds"
ExpiresByType text/javascript "access plus 2678400 seconds"
ExpiresByType application/x-javascript "access plus 2678400 seconds"
</IfModule>
# Cache Headers
<IfModule mod_headers.c>
# Cache specified files for 31 days
<FilesMatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=2678400, public"
</FilesMatch>
# Cache HTML files for a couple hours
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</FilesMatch>
# Cache PDFs for a day
<FilesMatch "\.(pdf)$">
Header set Cache-Control "max-age=86400, public"
</FilesMatch>
# Cache Javascripts for 31 days
<FilesMatch "\.(js)$">
Header set Cache-Control "max-age=2678400, private"
</FilesMatch>
</IfModule>
As you will notice, JS has expiration marks, is cached and compressed… so I tried removing the expiration and caching and problem persisted.
Then I tried to clean all the existing caches (note here for future references, so please correct me if I missed something) that, from server side to client, are:
OJS cache (cleaning with “find /var/www/html/cache -type f -delete”)
OJS memcache (disabled by default in config.inc.php)
Apache opcache (enabled > disabled in htaccess with “php_flag opcache.enable Off”)
Reverse proxy (traefik has no caching by default)
Browser local caching (with FF, Chromium)
And problem persists… so I will try to disable compression and (if it still fails) then all the rules, so at least we will know the culprit.
I disabled the optimization rules (as well as the apache “expires_module”) and things are back to normal.
So, I’m wondering what collides in OJS with those optimizations (that BTW, are make the site faster).
I love to help debugging, but my frontend skills are very rusted/outdated.
If I can do something to identify the issue, please let me know.
For instance, if you think it’s helpful, I will setup an OJS (3.3.0-14 and/or 3.4) clean installation with the former rules to see if we can reproduce the issue.