Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Are HttpSessions synchronized across multiple publish instances?

Avatar

Former Community Member

I understand that the use of HttpSessions is discouraged in AEM.  If we must use them, will they be synchronized across multiple publish instances if we are not using an enterprise application server and instead using the quick start deployment method?

As a follow up question, is there a way to avoid using HttpSession if we need server side session data for anonymous users?  Everything that I could find online indicates that jcr Sessions are tied to AEM credentials, meaning that 2 anonymous users would retrieve the same session data.

Please note this is AEM 5.6.1.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

Without running on an application server, which supports the synchronization of HTTP sessions, HTTP sessions are held only locally and are not shared.

Regarding the "server side data for anonymous user": You should not use the JCR repository to store such data (for a number of reasons). I would try to have it on the clientside as much as you can, and if you need to have them on the server, you the users are probably not really anonymous anymore. Or how do you differentiate one anyonmous visitor from another?

View solution in original post

2 Replies

Avatar

Level 10

Correct - HttpSessions are not best practice when using AEM.

Avatar

Correct answer by
Employee Advisor

Hi,

Without running on an application server, which supports the synchronization of HTTP sessions, HTTP sessions are held only locally and are not shared.

Regarding the "server side data for anonymous user": You should not use the JCR repository to store such data (for a number of reasons). I would try to have it on the clientside as much as you can, and if you need to have them on the server, you the users are probably not really anonymous anymore. Or how do you differentiate one anyonmous visitor from another?