Broswer 302 redirect issue

Hi Guys,
I met a problem and i spent all day to debug it :sleepy: but i did not find the root cause

The pb is : the browser use disk cache for an html page, but actullay the html cache is not actived:

But if i clear the cache, it will work well

This issue produced when i generated the cache in my server (css/js/html), the customer who were logined can not go to the checkout html page but redirect 302 to the cart page by disk cache

The life time of cookie setting is 20 days

my htaccess setting:

ExpiresActive On ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType text/css "access plus 1 week" ExpiresByType text/javascript "access plus 1 week" ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/vnd.microsoft.icon "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType font/woff2 "access plus 1 year" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType font/opentype "access plus 1 year" ExpiresByType font/ttf "access plus 1 year" ExpiresByType font/otf "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType application/x-font-otf "access plus 1 year"

my cloudflare cdn setting:
Caching Level = standard

Browser Cache TTL = 4hours

This issue made me mad, i wish someone can give me a help.
Thanks a lot.

the rest of response when disk cache

when disable bowser cache, it works well:

I am afraid that is not a Cloudflare issue, thats a typical browser caching issue and is better addressed at StackOverflow and alike.

thanks for your reply, my browser is chrome Version 80.0.3987.122

I understand, but the issue still is not Cloudflare related. It really is best to take this to stackoverflow.com :slight_smile:

i will post it in stackoverflow.com, thank you.

That being said, you might want to look into the Expires and Cache-Control headers. These currently simply seem to instruct the browser to cache the response.

For details on how to reconfigure I’d refer to StackOverflow however, as those details would really be beyond the scope of the forum.

HI, i chekced in my system log on my server,
i only have:
41.101.69.104 - - [30/May/2020:09:18:00 +0200] “GET /panier HTTP/1.1” 200 15775 “https://maison-des-meches.fr/panier
and i do not have 302 in acceess log.

so when user request: https://maison-des-meches.fr/commande
i think It is cloudflare give user 302 redirection response whith cache-control: max-age=2592000
but i do not konw why, html page should be no cach allowed.

since cloudfalre give 302 to redirect /panier, so borswer request /panier and my server give 200 for pinaer with cache-control: no cache.

Thats a request for “/panier”, you need to check for “/commande”.

In facct, the time line i think it is this:

user request: https://maison-des-meches.fr/commande with disk cache

cloudflare give user 302 redirection response whith cache-control: max-age=2592000 Location:https://maison-des-meches.fr/panier
(this request do not rise in my server, but cloudfare send cache-control max-age=2592000 and no cahce allowed, it is strange)

user request: https://maison-des-meches.fr/panier
this request rise in my server, my server reply 200, then cloud fare reply 200 with no-store, no-cache, must-revalidate.

I do not know why the frist request is not remonte in my server…

only one record in my server:
141.101.69.128 - - [30/May/2020:09:34:22 +0200] “GET /panier HTTP/1.1” 200 15777 “https://maison-des-meches.fr/panier

the response of cloudfare:

Unless instructed, Cloudflare does not change caching settings. That values comes straight from your server.

image

I am afraid that really is just the usual browser caching issue and should be discussed at StackOverflow.

many thanks, sandro.
i found an way to workaround it, i add an random ccid in the html after the commande
/commande?ccid=123 and my server will always retrun 200

i have an small question if you could help me:
i set Browser Cache TTL = 4hours in cloudfare

and today in my htaccess it is:
ExpiresByType text/css “access plus 1 week”

in myunderstanding, cloudflare will awalys take the longer cache lifetime.
if i set 2 hours in htaccess, cloudflare will take the 4hours as maxage in the reponse
if i keep 1 week in htaccess, cloudflare will take the 1week as maxage in the reponse
Is right?

but today i found the maxage in reponse of http it is 1 month for css. i dnt know this value come from where. It’s beyond me.

https://support.cloudflare.com/hc/en-us/articles/200168276-Understanding-Browser-Cache-TTL should cover that.

This topic was automatically closed after 14 days. New replies are no longer allowed.