Hello, everyone,
I try to set up httponly for cookies, no matter I set in php.ini or .htaccess file, it doesn't work.
My website: Opencart 3.0.3.2 + Journal 3 them.
Server info: Apache 2.4/ litespeed/php7.3
Litespeed said' In Header always edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure, edit is not supported'
https://www.litespeedtech.com/support/w ... es_by_lsws
What shall I do?
Thanks in advance!
I try to set up httponly for cookies, no matter I set in php.ini or .htaccess file, it doesn't work.
My website: Opencart 3.0.3.2 + Journal 3 them.
Server info: Apache 2.4/ litespeed/php7.3
Litespeed said' In Header always edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure, edit is not supported'
https://www.litespeedtech.com/support/w ... es_by_lsws
What shall I do?
Thanks in advance!
Last edited by moco123 on Tue Jan 12, 2021 10:11 am, edited 1 time in total.
You will probably have to find setcookie in the PHP files and add the flags you need.
For example these two locations for a start.
https://github.com/opencart/opencart/bl ... k.php#L108
https://github.com/opencart/opencart/bl ... on.php#L25
For example these two locations for a start.
https://github.com/opencart/opencart/bl ... k.php#L108
https://github.com/opencart/opencart/bl ... on.php#L25
Dear @ADD Creative,
Thanks for your help.
I think your idea is right. My server said that‘By default LiteSpeed has the Set-Cookie with a secure flag when served over HTTPS. It looks like these settings are actually being overwritten by the OpenCart script’.
According to your suggestion, I add 'ini_get('session.cookie_httponly')' to the files you mentioned. and set 'session.cookie_httponly = On' in php.ini flie. But still can't get the desired result.
I don't know if my settings are correct, I hope to get your further guidance.
Thanks again!
Thanks for your help.
I think your idea is right. My server said that‘By default LiteSpeed has the Set-Cookie with a secure flag when served over HTTPS. It looks like these settings are actually being overwritten by the OpenCart script’.
According to your suggestion, I add 'ini_get('session.cookie_httponly')' to the files you mentioned. and set 'session.cookie_httponly = On' in php.ini flie. But still can't get the desired result.
I don't know if my settings are correct, I hope to get your further guidance.
Thanks again!
You can't use session.cookie_httponly as this only affects the session cookie that OpenCart 3 does not use. You have to actually change the code.
Code: Select all
setcookie($config->get('session_name'), $session->getId(), ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain', true, true));
Who is online
Users browsing this forum: No registered users and 7 guests