Legacy Knowledge Base
Published Jun. 30, 2025

Set HTTPOnly, Secure and SameSite Attribute to All Cookies

Written By

Laura Li

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.
Note: please note that Liferay has renamed its Liferay Experience Could offerings to Liferay SaaS (formerly LXC) and Liferay PaaS (formerly LXC-SM).

Issue

  • We have a security scan done on our application. Some of the Cookies do not have HTTPOnly, Secure and/or SameSite attributes. How can we apply these attributes to NGINX?

Environment

  • Liferay DXP 7.4
  • Liferay PaaS 4.x

Resolution

  • Create an ssl.conf file in the /webserver/configs/{env}/conf.d folder.
  • Add proxy_cookie_path / "/; HTTPOnly; Secure; SameSite=strict"; to ssl.conf file. (Note: Here we use "strict" as an example. You may use appropriate value according to your use case.)
  • Deploy the build to your environment
  • Check the cookies 
    CheckCookies.png
  • The LFR_SESSION_STATE is not flagged with HTTPOnly. The reason is explained in this article. The related code in 7.4 can be found here.
  • The LFR_SESSION_STATE is not flagged with SameSite either. As this is JS cookie, the flag can only be set in Liferay code. We have a feature request LPS-133584 to implement this in the roadmap. 

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base