Add Secure and httpOnly Flags to Every Set-Cookie Response in Apache httpd

后端 未结 4 822
我在风中等你
我在风中等你 2021-01-30 18:20

I\'m running Apache 2.2.26:

Server version: Apache/2.2.26 (Unix)
Server built:   Jan 17 2014 12:24:49
Cpanel::Easy::Apache v3.22.30 rev9999 +cloudlinux
         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 18:44

    make sure that mod_headers.so is enabled then add the following header in apache2.conf for debian based system or httpd.conf for rpm based system

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

    For lower than Apache 2.2.4 version use the following:

    Header set Set-Cookie HttpOnly;Secure 
    

    then Restart the server

提交回复
热议问题