Q: When Compression is enabled on a NetScaler appliance, can you prevent the Cache-Control response header being set to the value private?
A: Yes. You can prevent the Cache-Control response from being set to the value private when compression is enabled on a NetScaler appliance. To prevent the Cache-Control response header being set to the value private in a response from the NetScaler appliance, you can perform any one of the following tasks:
- Prevent adding the Cache-Control response header
Run the following command from the shell prompt to prevent adding the Cache-Control response header:
# nsapimgr -ys cmp_no_cc_hdr=1
Note: Preventing addition of the Cache-Control response header is a global setting.
To ensure that this command persists even after the appliance is restarted, you can add the preceding command to the /nsconfig/rc.netscaler file. To add the command to the rc.netscaler file, run the following command from the shell prompt:
echo nsapimgr -ys cmp_no_cc_hdr=1 >> /nsconfig/rc.netscaler
Run the following command from the shell prompt to add a Vary header:
#nsapimgr -ys add_vary_header=1
To ensure that this command persists even after the appliance is restarted, you can add the preceding command to the /nsconfig/rc.netscaler file. To add the command to the rc.netscaler file, run the following command from the shell prompt::
#echo nsapimgr -ys add_vary_header=1 >> /nsconfig/rc.netscaler
To avoid compression, configure a NOCOMPRESS policy for a specific response that does not require the Cache-Control response header to be set to private or disable the Compression on the NetScaler appliance.
More Information
Setting the Cache-Control response header as private, such as Cache-Control: private, indicates that all or part of the response message is intended for a single user. It also indicates that the content must not be cached by a shared cache. This setting allows an origin server to state that the specified part of the response is intended only for one user and is not a valid response for requests sent by other users. A private, non-shared cache might cache the response.
The Vary field value indicates the set of request-header fields that completely determine whether a cache is permitted to be used as a response to a subsequent request without revalidation, while the response is fresh.