disable redirect caching

#1
hello,
i am doing redirects based on ip, and i see litespeed is caching it.
i am using geotargeting pro and the redirects are 302

i read this thread, but it speaks only about 301:
https://www.litespeedtech.com/support/forum/threads/redirects-issue.18320/

i also read this, but it speaks only about mobile:
https://www.litespeedtech.com/suppo...le-cache-for-redirect-to-mobile-version.7023/

can you please assist me what i should put in .htaccess to avoid those redirects caching, so every time someone approach the page i setup redirect rule, it will check what to do?
 
#3
thanks for the answer

you can download the plugin from here:
https://geotargetingwp.com/geotargeting-pro

register free of charge to trial

then once the plugin is installed, create a geo retargeting rule for
if country = XXX
and page = XXX

then 302 redirect to NEW PAGE

this will create a redirect caching, so even if you are logged in from another country, then it would still redirect to the rule page

based on your previous answer and this thread:
https://www.litespeedtech.com/support/forum/threads/redirects-issue.18320/

i can understand that if i put in my .htacess

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://DOMAIN /$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://DOMAIN /$1 [R=302,L]


it will not cache my redirects?
 
#6
yes of course
so is the solution they proposed in this
Geotargeting gave this explanation, but not sure where to create this cookie

https://geotargetingwp.com/docs/geotargetingwp/how-to-configure-litespeed
will work?

or shall i go with solution similar to this?

"based on your previous answer and this thread:

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://DOMAIN /$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://DOMAIN /$1 [R=302,L]"


please write me what you think i should do
 
#8
@hamzaleg

Redirecting with 302 is no good idea, because almost every browser caches it and can't be avoided on server side. Always use only 301 redirection to avoid caching.
it has to be 302, since its redirect based on country, and we don't want the search engine to think its permanent redirect.

hanse we want a solution so litespeed don't cache the redirect
 

serpent_driver

Well-Known Member
#10
it has to be 302, since its redirect based on country, and we don't want the search engine to think its permanent redirect.
Once again, if you send redirection header 302 browser will cache it, not LiteSpeed. LiteSpeed neither caches it, nor can control browser cache behaviour if this header is sent. It is not possible to send 302 header and to tell browser that he shouldn't cache it. It is inherent to the system.

"Wash me, but don't make me wet" is what you want. ;)

To solve this conflict, exclude Google from redirection, but it isn't 100% safe because Google will check it that user is redirected. This will happen if users use Chrome and if they are logged in to Google account.
 
Last edited:
#11
what you say is interesting and tell me if i understand

are you saying that the redirect is only cached on the browser level, and if i go to another browser or another computer, the redirect is not cached?
 
Top