Post by goksel1961 » Fri Oct 11, 2024 3:07 pm

Hello,
OC version 3038
Platform ubuntu 22.4
Browser Chrome (updated)
When a php error occured i correct it and be sure the file in server updated. But old code runs till i reset the Chrome settings every time. I tried "blue button" in opencart admin also modification cache clean but no way. I use opencard about 10 years my first faced this kind of a problem. I think if its solved when i reset the chrome settings then problem is on client side.
Anyone had same experience ?
Thanks

New member

Posts

Joined
Wed Apr 10, 2019 10:30 pm

Post by ADD Creative » Fri Oct 11, 2024 5:06 pm

Could be a cache control header issue. Use chrome's web developer tool (F12). Check the console for errors. Then use the network tab to see what is being cached. Also use the disable cache option.

The headers were added to 3.0.4.0.
https://github.com/opencart/opencart/pull/13599

www.add-creative.co.uk


Guru Member

Posts

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

Post by JNeuhoff » Fri Oct 11, 2024 5:31 pm

@ADD Creative: Unfortunately Chrome doesn't appear to respect the standard Cache-Control: no-store anymore. E.g. when you update server resources, e.g. *. js, or *.css, or *.png files, while keeping the same URL for them, Chrome may still use old caches for them. I am still looking for some workaround for this issue.

BTW.: We shouldn't use no-store and no-cache at the same time, it should only be one of them at a time.

The whole OpenCart caching strategy is quite messy at the moment and should be carefully looked into it again.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ADD Creative » Fri Oct 11, 2024 7:05 pm

JNeuhoff wrote:
Fri Oct 11, 2024 5:31 pm
@ADD Creative: Unfortunately Chrome doesn't appear to respect the standard Cache-Control: no-store anymore. E.g. when you update server resources, e.g. *. js, or *.css, or *.png files, while keeping the same URL for them, Chrome may still use old caches for them. I am still looking for some workaround for this issue.
That the way it's meant to work for static resources (the one not generated by PHP). Once a web browser caches a static file the only way to serve new content is to change the URL. Other wise you would need to wait for the expiry time or the user would need to clear their browser cache.

The cache control header for static resources are not set in PHP. The expiry time for them can be controlled by ExpiresDefault, ExpiresByType, etc in htaccess. You could set them to 0 or very small while developing, but that would affect web server performance as they would be requested for every page load.
JNeuhoff wrote:
Fri Oct 11, 2024 5:31 pm
BTW.: We shouldn't use no-store and no-cache at the same time, it should only be one of them at a time.
The cache control headers were taken from the PHP documentation. Which uses both no-store and no-cache. While no-store on it own should be enough there would be no harm in keeping the others, most restrictive directive would be honoured, they are probably for different browser or proxy compatibility. You can see the values PHP uses at https://www.php.net/manual/en/function. ... he-limiter.

It looks like only recently (after my pull request) they have updated the documentation https://github.com/php/doc-en/pull/3361. They have removed some of the headers (needed for IE5) but still have both no-store and no-cache.
https://github.com/php/doc-en/pull/3361

www.add-creative.co.uk


Guru Member

Posts

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

Post by JNeuhoff » Fri Oct 11, 2024 7:33 pm

The no-cache does not necessarily mean "don't cache". no-cache allows caches to store a response but requires them to revalidate it before reuse.

If the sense of "don't cache" that you want is actually "don't store", then a single no-store is the directive to use.

This logic works fine for FireFox. But Chrome stubbornly caches the static resources, even when told not to do so via a single no-store directive.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ADD Creative » Sat Oct 12, 2024 12:06 am

JNeuhoff wrote:
Fri Oct 11, 2024 7:33 pm
The no-cache does not necessarily mean "don't cache". no-cache allows caches to store a response but requires them to revalidate it before reuse.

If the sense of "don't cache" that you want is actually "don't store", then a single no-store is the directive to use.

This logic works fine for FireFox. But Chrome stubbornly caches the static resources, even when told not to do so via a single no-store directive.
Yes, I was aware of the differences between no-cache and no-store. Using no-store on its own should work fine. As I said the other bits are just for compatibility with old browsers and proxies.

I see what you mean about Chrome caching static resources even if no-store is set. Just tested and could see resources being pulled from the memory cache. It was only from the memory cache, never from the disk cache and only on using the back button, never a refresh. I guess as memory is volatile storage they don't consider it being stored.

What situation is that causing a issue for you?

www.add-creative.co.uk


Guru Member

Posts

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

Post by JNeuhoff » Sat Oct 12, 2024 1:26 am

What situation is that causing a issue for you?
For example, coming to your OpenCart-based website, to the home page, for the first time, Chrome puts all the static resources into a memory cache. User then clicks on the Contact Us link (information/contact) which, despite a single no-store in the response, causes Chrome to fetch almost all static resources (which where retrieved from the home page) from the memory cache, to be used for rendering the information/contact page in Chrome.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by goksel1961 » Sun Oct 13, 2024 1:59 pm

Thank you all for your kindly interest . Really appreciated .
I will do your suggestions and drop a note here when a change occurs. Take care.

New member

Posts

Joined
Wed Apr 10, 2019 10:30 pm

Post by ADD Creative » Wed Oct 16, 2024 5:04 pm

JNeuhoff wrote:
Sat Oct 12, 2024 1:26 am
What situation is that causing a issue for you?
For example, coming to your OpenCart-based website, to the home page, for the first time, Chrome puts all the static resources into a memory cache. User then clicks on the Contact Us link (information/contact) which, despite a single no-store in the response, causes Chrome to fetch almost all static resources (which where retrieved from the home page) from the memory cache, to be used for rendering the information/contact page in Chrome.
I could never recreate that scenario. I could only get Chrome to serve from the memory cache using back and forward browser buttons.

I can see that it's not expected behaviour, but not why static resources being cached would be an issue in that case.

www.add-creative.co.uk


Guru Member

Posts

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

Users browsing this forum: No registered users and 9 guests