Post by synapseindia » Mon Nov 12, 2018 7:00 pm

Hi Guys,
I have reviewed that most of the opencart users are getting cache issue on 3.x versions.
Even i was also facing cache issue such as updated cart and design updated issue.
I have found a solution to fix the same. You can add below code into the htaccess file it will fix your issue.

Code: Select all

<IfModule mod_headers.c>
	Header set Cache-Control "no-cache, no-store, must-revalidate"
	Header set Pragma "no-cache"
	Header set Expires 0
</IfModule>
Thanks

User avatar
Active Member

Posts

Joined
Thu Apr 05, 2018 2:27 pm

Post by ADD Creative » Mon Nov 12, 2018 8:56 pm

That's not quite right as it will prevent caching of you static files (images, stylesheets, JavaScript, ect.).

It would be best to add the cache control headers to the PHP responses only. See the link below for an example.
viewtopic.php?f=201&t=207498#p737358

I've submitted an bug report here.
https://github.com/opencart/opencart/issues/7008

www.add-creative.co.uk


Guru Member

Posts

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

Post by synapseindia » Mon Nov 12, 2018 9:22 pm

ADD Creative wrote:
Mon Nov 12, 2018 8:56 pm
That's not quite right as it will prevent caching of you static files (images, stylesheets, JavaScript, ect.).

It would be best to add the cache control headers to the PHP responses only. See the link below for an example.
viewtopic.php?f=201&t=207498#p737358

I've submitted an bug report here.
https://github.com/opencart/opencart/issues/7008
Great to hear response on this.
I will try this and shall share the feedback .
But i was facing this cache issue since long so it was awsome code to resolve the issue.

Thanks

User avatar
Active Member

Posts

Joined
Thu Apr 05, 2018 2:27 pm

Post by imdevlper18 » Mon Apr 05, 2021 1:21 pm

Was facing a similar issue on the client website with the extension modification page.
Opencart version 3.0.3.6
The client was using FastComet Server.

Added .htaccess code of mod_headers for expiry. But that did not help.

Later I contacted the server. And they had caching enabled.
Xvarnish Cache.
So disabling that fixed the issue.

Opencart Extensions | Professional opencart support | Support Ticket | support@cartbinder.com


User avatar
Active Member

Posts

Joined
Sun May 11, 2014 2:04 pm

Post by straightlight » Mon Apr 05, 2021 8:04 pm

imdevlper18 wrote:
Mon Apr 05, 2021 1:21 pm
Was facing a similar issue on the client website with the extension modification page.
Opencart version 3.0.3.6
The client was using FastComet Server.

Added .htaccess code of mod_headers for expiry. But that did not help.

Later I contacted the server. And they had caching enabled.
Xvarnish Cache.
So disabling that fixed the issue.
Good to know. I did explained in the past on the forum this issue might be server-related somewhere. Glad to see the issue was solved after disabling a server cache. :)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: 7cswinery and 62 guests