Title: LS Cache + Password Protected
Last modified: September 12, 2021

---

# LS Cache + Password Protected

 *  Resolved [ghosted](https://wordpress.org/support/users/ghosted/)
 * (@ghosted)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/)
 * Issue: if example.com homepage/any page has been previously viewed && cached 
   Password Protected doesn’t fire to verify the security cookie exists and the 
   302 to password protected password entry is bypassed completely.
 * Is there any way to have the initial request sent to the sever or have LS Cache
   check for the existence of the cookie.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14864244)
 * Hi,
 * please try add this at top of your .htaccess
 *     ```
       <IfModule LiteSpeed>
       RewriteRule .* - [E=Cache-Vary:cookie_name]
       </IfModule>
       ```
   
 * change the `cookie_name` to the cookie you want to have it checked
 * and then purge all , and restart webserver if you are using OpenLiteSpeed
 * Best regards,
 *  Thread Starter [ghosted](https://wordpress.org/support/users/ghosted/)
 * (@ghosted)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14864540)
 * Unfortunately doesn’t seem to make a difference. Password protected has a default
   cookie name “bid_1_password_protected_auth”.
 *     ```
       <IfModule LiteSpeed>
       RewriteRule .* - [E=Cache-Vary:bid_1_password_protected_auth]
       </IfModule>
       ```
   
 * At the top of .htaccess yielded no results.
 * edit: wouldn’t there need to be a rule to bypass the cache with this, from what
   I’m reading it’s only to detect a cookie it wouldn’t do anything other than that?
    -  This reply was modified 4 years, 6 months ago by [ghosted](https://wordpress.org/support/users/ghosted/).
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14868441)
 * Hi,
 * this rule will vary the cache , by that saying
 * generate one cache for user who has this cookie , and another cache for user 
   who doesn’t have this cookie
 * if you remove what you added in previous, then you go to Cache -> Exclude -> 
   Do not cache cookie , add your cookie name there, save and purge all , how does
   that go ?
 *  Thread Starter [ghosted](https://wordpress.org/support/users/ghosted/)
 * (@ghosted)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14875971)
 * I have it set up to exclude the cookie already as well as the string in the uri
   identifying the password protected form to enter the password. Those both seem
   to work. Unfortunately the absence of the “bid_1_password_protected_auth” cookie
   doesn’t seem to load the password entry page with
 *     ```
       <IfModule LiteSpeed>
       RewriteRule .* - [E=Cache-Vary:bid_1_password_protected_auth]
       </IfModule>
       ```
   
 * in the header of .htaccess.
    Is there perhaps a place to add the rewrite rule
   somewhere in Openlitespeed directly? I haven’t been able to find anything in 
   relation to doing that.
 * thx for your continued help.
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14876546)
 * Hi,
 * Did you restart OLS after you edited .htaccess ?
 * it won’t take effect in OLS until you restart it
 * > I have it set up to exclude the cookie already
 * what’s the cookie name you excluded ? same as the one in the rule ?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘LS Cache + Password Protected’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

## Tags

 * [lscache](https://wordpress.org/support/topic-tag/lscache/)

 * 5 replies
 * 2 participants
 * Last reply from: [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/ls-cache-password-protected/#post-14876546)
 * Status: resolved