javaapachetomcathttpd.confmod-jk

Confused about session management between Apache httpd and Tomcat using mod_jk


I am confused about session management between Apache httpd and Tomcat using mod_jk. I know that Apache is typically used for serving http pages, and Tomcat is used as instructions for handling different types of web requests. So when an application using both of these receives a request, does Apache create a session where within that session a Tomcat session is created? I am asking this because none of the changes I make to sessions in my apache httpd.conf file seem to take affect, but the changes I make to my Tomcat config files do affect my application.


Solution

  • Apache httpd is - especially when mod_jk is in the game - a reverse proxy for Tomcat. It typically does little more than forwarding requests and responses.

    If a tomcat-based web application requires a session, Tomcat will create the session and handle it typically with a cookie. This session information is part of the proxied content, which Apache httpd neither creates, deletes or manipulates (unless you explicitly configured it to do so, in which case you'd knew that you did).

    In case Apache httpd has some other components (e.g. PHP based) that require sessions, this part of session handling would be subject to the PHP application.

    Tomcat sessions behave the same, no matter if they're proxied or not. So, Apache httpd has (unless you cause it to) no effect on Tomcat sessions.