Post by Zanato » Sat Jul 18, 2020 5:49 pm

Hi,

I've migrated servers from shared hosting to Cloud VM. Both apach, both PHP 7.2.

Website is OC3.0.2.0. - My host did a straight copy and paste from one server to the other and just updated config/database parameters.

Everything is working fine except two thing I've noticed that are probably related to the same problem...
1. When I change the status of an order it does not 'live update' in the order history box. I have to refresh the page to see the change.
2. When I clear the Maintenance>Error Log nothing happens, again, I have to refresh the page to see any change.

No errors in server logs, no errors showing in Chrome Inspector.

I've refreshed all caches, cookies, etc that I think may be effecting this but to no avail.

Anyone any ideas?

PS: I figured this must be some config diffrence between the two servers so I set up a subdomain and installed a clean 3.0.2.0 to see if it had the same problem but it doesn't. Everything works as expected.

tl;dr... the issue was caused by a misconfigured .htaccess file.
Last edited by Zanato on Sat Jul 25, 2020 3:25 pm, edited 1 time in total.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by ADD Creative » Sat Jul 18, 2020 8:30 pm

Could be a cache control issue. viewtopic.php?f=202&t=206449#p786660

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Zanato » Tue Jul 21, 2020 3:15 am

Thank you very much Add Creative! The fix in the post you linked to has resolved the issue.

But, why did it not work after the move to the new server? I installed a clean test site on a sub domain and that DID work, on the same server. Why was one working and not the other?

Also, should I leave that modification in place or remove it again?

Thank you again for your help!

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by Zanato » Tue Jul 21, 2020 3:57 am

I spoke too soon.

The status updates on orders do now update immediately in the Order History panel.

However, clicking the Clear button on the Errors page only worked once and hasn't worked again since. Also, the Refresh button on the modifications page is not doing anything.

EDIT: If I open admin in an incognito tab the buttons will work once each, but second and subsequent attempts fail.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by ADD Creative » Wed Jul 22, 2020 12:06 am

Check the requests in the web browser's development tool network tab.

When clearing log there should be a call to index.php?route=tool/log/clear which will return an 302 redirect status. Redirecting to index.php?route=tool/log which should return a 200 status. Both should not be cached, so check the response headers such as Cache-Control, Expires and any other that may be relevant.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Zanato » Wed Jul 22, 2020 1:33 am

Thank you very much again ADD Creative. You're help is very much appreciated.

Both the call and the redirect you mention above seem to be working fine.

Here's the header info... (note the modification you linked to earlier is still active)

Code: Select all

cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
content-encoding: gzip
content-length: 3456
content-type: text/html; charset=utf-8
date: Tue, 21 Jul 2020 17:26:19 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
ms-author-via: DAV
pragma: no-cache
server: nginx
set-cookie: OCSESSID=e75b81f8ebcd879254e08d70de; path=/
status: 200
vary: Accept-Encoding
x-powered-by: PHP/7.2.32
x-powered-by: PleskLin
I'm not sure if it's relevant but here is my .htaccess...

Code: Select all

Options +FollowSymlinks
RewriteEngine On 
Options -Indexes

RewriteBase /

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteRule ^SALE special [R=301,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]
# Prevent Directoy listing

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 2 month"
ExpiresByType image/jpeg "access 2 month"
ExpiresByType image/gif "access 2 month"
ExpiresByType image/png "access 2 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 1 month"
</IfModule>

## EXPIRES CACHING ##
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE image/svg+xml svg svgz
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-woff
    AddOutputFilterByType DEFLATE application/x-font-woff2
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/eot
    AddOutputFilterByType DEFLATE font/woff
    AddOutputFilterByType DEFLATE font/woff2
    AddOutputFilterByType DEFLATE font/opentype
	AddType x-font/otf .otf
	AddType x-font/ttf .ttf
	AddType x-font/eot .eot
	AddType x-font/woff .woff

	# For Olders Browsers Which Can't Handle Compression
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.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>
There is no .htaccess in my admin folder.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by sw!tch » Wed Jul 22, 2020 3:38 am

Why put all the <IfModule mod_expires.c> crap in there? ExpiresDefault 1 month?? Try removing all the ## EXPIRES CACHING ## edits.

If that doesn't solve it then its most likely a server configuration issue.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by Zanato » Fri Jul 24, 2020 2:19 am

Hi Sw!tch,

All the <IfModule mod_expires.c> stuff was put in as it was recommended by Google Pagespeed and GT Metrix. Though it does appear to be what was causing the problem, removing it has fixed the issue. Odd that it wasn't a problem on the old server though.

I don't know where the ExpiresDefault "access 1 month line came from. Perhaps it was just this that was causing the problem. I'll have to test further.

Thank you both for your help.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by sw!tch » Fri Jul 24, 2020 2:49 am

Zanato wrote:
Fri Jul 24, 2020 2:19 am
Hi Sw!tch,

All the <IfModule mod_expires.c> stuff was put in as it was recommended by Google Pagespeed and GT Metrix. Though it does appear to be what was causing the problem, removing it has fixed the issue. Odd that it wasn't a problem on the old server though.

I don't know where the ExpiresDefault "access 1 month line came from. Perhaps it was just this that was causing the problem. I'll have to test further.

Thank you both for your help.
Yeah I don't see the point in caching stuff for a month or even 2 months. Opencart is a dynamic system where content can be ever changing, I feel any forced cache that you can't manually flush or regenerate is terrible.

If you are keen on using cache try something like a CDN or cloudflare where you at-least have some control over cached assets and can flush the cache if needed.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by letxobnav » Fri Jul 24, 2020 7:41 am

for OC expire headers are fine.

Just never use:

Code: Select all

ExpiresDefault "access 1 month"
and then not specifically exclude text/html and data as in OC those are dynamic and should not be browser cached.

use:

Code: Select all

# Default expiration: now
	ExpiresDefault A0
or if you must set a lengthy ExpireDefault then make sure text/html and data are specified as not using it.

Code: Select all

# Do not browser cache html
  ExpiresByType text/html "access plus 0 seconds"
# Do not browser cache Data
  ExpiresByType text/xml "access plus 0 seconds"
  ExpiresByType application/xml "access plus 0 seconds"
  ExpiresByType application/json "access plus 0 seconds"
  ExpiresByType text/plain "access plus 0 seconds"

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Zanato » Sat Jul 25, 2020 3:31 pm

sw!tch wrote:
Fri Jul 24, 2020 2:49 am
If you are keen on using cache try something like a CDN or cloudflare where you at-least have some control over cached assets and can flush the cache if needed.
Yea I have Nitropack.io running on the front end which gives excellent results (for about €400/year).

I've tested further and ExpiresDefault was indeed the problem.

Thanks for the insightful post letxobnav!

Issue now marked as resolved.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland
Who is online

Users browsing this forum: No registered users and 141 guests