I am facing cache issues with the currency switcher of Houzez
I have tried different solutions that have seen on this forum but unfortunately none of them have been successful yet.
When switching currency, a cookie houzez_set_current_currency
is set but the currency doens’t change (unless I load a new page). For example I’m currently in EUR and switch to USD, the page is refreshed but the previous cache is hit and my currency still in EUR. Then I visit another page (not cached yet) and now the currency will be in EUR.
It happens sometimes than the expected behaviour happens like currently for this one for example (at least from my browser)
I have already added the cookie in vary:
RewriteRule .? - [E="Cache-Vary:houzez_set_current_currency"]
I also tried to add this filter:
add_filter( 'litespeed_vary_cookies', function( $list ) { $list[] = 'houzez_set_current_currency'; return $list; } );
I also tried to disabled the guest mode.
I’m running out of ideas :/
Kind regards,
Chris
]]>How does QUIC.cloud serve these pages (without requesting the origin server)?
As a result, I’ve come to the conclusion that I need a variation for the WP Role that the logged-in users have (Reseller). After reading the documentation, I realized that to achieve this, I need to:
However, this does not work at all. After extensive troubleshooting, I discovered that ESI needs to be enabled. In the documentation, it explicitly states that it does not need to be enabled. Am I misunderstanding something here, or is the documentation wrong?
I also found a workaround, if I add this action to functions, the ESI-option do not seem to be enabled.
do_action( 'litespeed_control_force_public' );
]]>When I navigate through the website in incognito mode or with a new browser for the first time, a _lscache_vary cookie is set.
-> But, after visiting some pages or after going from the subdomain site to the main domain site, a second _lscache_vary cookie is set and the existing one remains there.
After this, each refresh of the page miss the cache.
I noticed that on both cookies there is often one with a single dot “.” prefix (meaning that it apply to all subdomain) and one without this prefix.
This behavior is strange and makes the cache not used 70% of the time.
]]>I am trying to vary the LSCache based on the country code, as set in the incoming HTTP header request by CloudFlare. I have this at the bottom of my .htaccess:
<IfModule LiteSpeed>
# Vary cache by region
RewriteCond %{HTTP:Cf-Ipcountry} (.*)
RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+%1]
</IfModule>
But it does not seem to work. Any ideas on how to get this working?
]]>I have been working heavily on optimising our page with litespeed plugin connected to a CDN and my limited PHP knowledge is stopping me from generating a public cache for pages. I would try the V3 to see if that would solve my problem but unfortunately I do not meet PHP version requirements so at the moment I am stuck with the previous version… I can not seem to exclude this variable from caching as a vary:
</label></p><input type=”hidden” name=”age_gate[age]” value=”TVRnPQ==” /><input type=”hidden” name=”action” value=”age_gate_submit” /><input type=”hidden” name=”age_gate[nonce]” value=”832ce7b546” /><input type=”hidden” name=”_wp_http_referer” value=”/product-category/e-liquid/xxx/” /><input type=”hidden” name=”confirm_action” value=”0″ /></form></div></div>
As you can imagine every time the age gate is generating 832ce7b546 new page is being made making the cache useless. I had a very similar issue with another plugin called WCPA that generated values inlined but I managed to make a vary entry in my .htaccess file forcing it as a “random” unique so my public cache remains intact.
The code after looked like this:
var wcpa_global_vars = {"wc_currency_symbol":"\u00a3","wc_thousand_sep":",","wc_price_decimals":"2","wc_decimal_sep":".","price_format":"%1$s%2$s","wc_currency_pos":"left","date_format":"F j, Y","date_format_js":"MMMM D, YYYY","time_format":"g:i a","time_format_js":"h:mm a","use_sumo":"","start_of_week":"1","today":{"days":18713,"seconds":1616834724},"google_map_api":"","google_map_countries":"","ajax_url":"https:\/\/xxxxxxxx.xx.xx\/wp-admin\/admin-ajax.php","change_price_as_quantity":"","show_field_price_x_quantity":"","show_strike_product_price":"","strings":{"ajax_file_upload":"Files are being uploaded...","ajax_upload_error":"Upload error","sel_min_req_error":"You have to select minimum %d items","sel_max_req_error":"You can select maximum %d items","fix_val_errors":"Please correct the errors shown for fields","field_is_required":"This field is required","character_not_valid":"Character %s is not supported","sumo_strings":{"captionFormat":"{0} Selected","captionFormatAllSelected":"All {0} selected!"}},"wcpa_init_triggers":["qv_loader_stop","quick_view_pro:load","elementor\/popup\/show","xt_wooqv-product-loaded","woodmart-quick-view-displayed","porto_init_countdown"]};
So that was straightforward – I grabbed the identifier and made a caching rule that looked like this:
RewriteEngine on
RewriteRule .* – [E=Cache-Vary:wcpa_global_vars]
If the 832ce7b546 was identified as something else other than
value=””
I would probably put it inside the same scheme and forget about it but this identifier is too generic and it is used across multiple functions so I can not possibly use it.
In the code I have noticed
name=”age_gate[nonce]”
and I thought – oh, great, I can put it through ESI content that is private for every user but that made no difference. The code is still there and it is being inlined into the page.
Any insight into my issue would be greatly appreciated.
]]>I run a site with WooCommerce & WPML. I have 2 languages, Swedish default and English as secondary. I have WPML configured using separate URL:s for each language. So when accessing Swedish language visitors is on www.armsportbutiken.se and on English language visitors in on www.armsportstore.com, even though it is the same site.
So I use currency converter widget that is only used for informational purposes, the customer always purchase with the Swedish currency SEK. But they can chose to view the prices in different currencies to estimate the cost in their local currency.
I have been reading a lot about how to make sure the currency converter choice is only for the current visitor. And cookie vary seems to be the way to go. The cookie used by the currency converter is named: woocommerce_current_currency
I have tested with adding this code to the .htaccess and have been running with this for a while:
# BEGIN CUSTOM LSCACHE SETTINGS
<IfModule LiteSpeed>
RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule .* - [E=Cache-Vary:woocommerce_current_currency]
</IfModule>
# END CUSTOM LSCACHE SETTINGS
The reason that I ask about this is that I have noticed that sometimes when I browse the site from different browsers with/without VPN enabled just to check if everything works, sometimes I see the site in a currency I haven’t chosen myself. This makes me guess that I see the currency as someone else who visited the site have chosen that currency, which is what I want to get rid off.
The code above is what I found in different forums/posts. But I also found an alternate rewrite rule:
RewriteRule .? - [E=Cache-Vary:woocommerce_current_currency]
And I don’t understand the difference between using .* or .?
So to sum up my questions:
1. Which is the correct rewrite rule? The one with .* or the one with .?
2. Is the full code above the correct code to insert to .htaccess to have vary on that cookie?
3. Where in the htaccess-file should this be placed? Does it matter where it is?
So please respond like I am a child, as I have no clue what so ever about rewrite rules and .htaccess configuration.
]]>The plugin generated 228 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
. Somehow installed. I am fed up of these issues. The list of problems goes below:-
1. My Server has brotli, so turned off gzip. Now Cache Control is
cache-control: max-age=3597, public, public
Why public-public twice, if i turn on gzip it is back to single public.
2. On HTML pages, vary:Accept-Encoding,Cookie . I want to remove this as i am not compressing so why accept encoding. This vary header is already set by my server if i use brotli. So vary Header is:
vary: Accept-Encoding
vary: Accept-Encoding,Cookie
3. On other than HTML Requests like css, js. Vary Header is
vary: Accept-Encoding,X-Forwarded-Proto
How can i remove these and solve the issues. I need clean vary: Accept-Encoding only once for Google Cloud CDN as anything appended other than this to vary leads to no cache of resource.
Hope get fix soon
vary: Accept-Encoding
Instead of vary: X-Forwarded-Proto,Accept-Encoding as it is right now on my pages.
Is there an option to check/unchek in W3 Total Cache to change it ?
]]>