Respecting Cache-Control Header

#1
Hello,

We're currently exploring an option to move a large-scale enterprise application to use LSCache. However from what I'm reading LSWS ignores existence of the "Cache-Control" header and instead suggests using pseudo-rewrite rules to control caching times.

The solution suggested is completely not acceptable for us, since the application dynamically scales the caching times based on business rules and has fully developed support for "Cache-Control". It currently properly sets "max-age" as well as "smax-age", expecting proxy server to respect "smax-age" while leaving browsers with "max-age" (which is how it suppose to be by the RFC).
Varnish offers such option by default, but it doesn't terminate SSL and adds another layer to the stack - if possible we will like to avoid that. Is it possible to achieve such scenario in LSWS?

Additionally the application uses "Vary" header on a custom (X-Foo: 1|0) header sent by API clients. Does LSCache handle "Vary" header properly, i.e. stores two distinct version of the resource for two values of the header?

I will be glad if someone can address the questions here, since currently we started trailing the LSCache and we're wandering in the dark slightly :)
 

Lauren

LiteSpeed Staff
Staff member
#2
Hi,

LSCache is more intelligent. We use a separate header "X-LiteSpeed-CacheControl", if this header exists, it will be honored instead of "Cache-Control". As most dynamic apps will always set "Cache-Control: nocache". When LiteSpeed special header is missing, and you set in cache config "Respect Cacheable", it will honor regular Cache-Control header.

We do not use "Vary" header directly, as if Vary by user agent, there will be too many copies of same data. "X-LiteSpeed-Vary" is used instead. If you already build the proper support with "Vary" header, you can easily using a rewrite rule to convert Vary header to LSCache vary value.
We have a dev doc not very complete, but you can take a look first.

If your application already work with a cache proxy server, then it's very easy to convert. But LSCache offers something more powerful, maybe allow you to cache your contents longer and only flush it with real purge events.

You are welcome to join our slack

Lauren
 

Lauren

LiteSpeed Staff
Staff member
#3
Varnish offers such option by default, but it doesn't terminate SSL and adds another layer to the stack - if possible we will like to avoid that. Is it possible to achieve such scenario in LSWS?
We have a graph showing simplified stack comparing to varnish for LiteMage2. You get simpler stack, and LSWS supports HTTP/2, QUIC, TLS/1.3 out of box. Basically you don't even need HTTPS termination, as you do not need to proxy to other layer. If you do need to proxy, our Web ADC product will fit the needs, like we have clients using IIS behind LiteSpeed ADC to take advantage of LSCache and HTTP/2 HTTP/S termination.
 
Top