New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to map Nginx http response header?
I tried several configs but seems to not work, like...
map $http_x_litespeed_cache_control $nocacheheader {
default 0;
no-cache 1;
}
map $upstream_http_x_litespeed_cache_control $nocacheheader {
default 0;
no-cache 1;
}
map $sent_http_x_litespeed_cache_control $nocacheheader {
default 0;
no-cache 1;
}
Page is still cached.
What is the correct format?
My HTTP response header:
x-litespeed-cache-control no-cache
Thanks!
Comments
Well technically, it is the right format. Your nginx won't be able to start if the format is wrong.
Why so complicate setup? Cache control can be tuned up for location. What are you trying to achieve?
But, Page is still cached and not bypass.
I just don't want to cache a page if that header is present.
In addition to my current mapping/rule.
Where are you getting litespeed_cache_control header from?
From an addon: https://xenforo.com/community/resources/litespeed-cache-for-xf2-community.6248/
To have a persistent cookie and header for logged user.
I am the one who suggest this add-on for you but I'm not sure it send this header.
I don't have this header on my site.
Is you site running nginx or litespeed?
Nice, Thanks again .
I'm using Nginx and yes I got that header for logged users.
x-litespeed-cache-control: no-cache
Is always present for logged users.
x-litespeed-cache-control is a Litespeed header: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:developer_guide:response_headers
x-litespeed-cache-control: no-cache
header was added by that addon, kindly look at the addon php code to confirm.Hi, you're right .. for some reason I missed that header.
$sent_http_x_litespeed_cache_control
is the variable you need to use:https://nginx.org/en/docs/http/ngx_http_core_module.html#var_sent_http_
You're ideia is just use this header to map pages that will be cached or not, instead of cookies?
Haven't tried that
Care to share the full cache config?
My idea was to use that as 3rd bypass option as no_cache cookie and uri isn't sufficient, I'm still seeing very random times member page being cache and displayed to Guest.
I did try almost every possible config/way I can think of, but still not working.
Still looking for right config
How is that nginx connected with Litespeed ?
Please read my previous post above.