I have a requirement on Apache 2.4 wherein I'd like to check for specific cookies and set the HTTPOnly plus Secure flags only on those Cookies and ignore other Cookies.

E.g. On browser I have the following Cookies for the same web domain i.e. CookieA, CookieB, CookieC, CookieD, CookieE, CookieF.

However in Apache (mod_headers), I'd like to match using CookieName only CookieB and CookieC; then update the settings for HTTPOnly and Secure Flags only for CookieB and CookieC.

PseudoLogic :

If getAllCookies contains CookieB
  then update only CookieB  (Header edit Set-Cookie (CookieB) "$1; HTTPOnly; Secure"
elseIf getAllCookies contains CookieC
  then update only CookieC  (Header edit Set-Cookie (CookieC) "$1; HTTPOnly; Secure"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.