Edit Cookie HttpOnly value

不想你离开。 提交于 2020-03-03 07:28:10

问题


Due to PCI regulations, most cookies in my application need to be secure and httponly. I have achieved that through this line in my Apache config file:

Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure

However this breaks part of the application where a single cookie, let's call it foobar, must be read by javascript. Therefore I need to remove the httponly for this cookie only.

I've played around with several approaches including mod_rewrite but I can't get the httponly to drop off the cookie. I don't want to reset the value of the cookie etc, just take off the httponly part.

E.g. Header always edit Set-Cookie ^(foobar=.*)$ $1 (doesn't work)


回答1:


Try this:

Header edit Set-Cookie ^((?!foobar=).*)$ $1;HttpOnly;Secure


来源:https://stackoverflow.com/questions/41173890/edit-cookie-httponly-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!