Skip to content

Stop creating a session for every weblog page view - #248

Merged
mraible merged 6 commits into
apache:masterfrom
mraible:fix-session-per-page-view
Nov 14, 2026
Merged

mraible merged 6 commits into
apache:masterfrom
mraible:fix-session-per-page-view

Conversation

@mraible

@mraible mraible commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

While running a 7.0.0 snapshot against a copy of my site, I noticed every weblog page, feed and resource response carried a Set-Cookie: JSESSIONID. On 5.0.3 none of them did.

The cause is LoadSaltFilter. It's mapped to /roller-ui/*, and since #167 it runs on FORWARD as well as REQUEST. Weblog requests are forwarded to the rendering servlets under /roller-ui/rendering/, so the filter runs for each one, calls getSession(true) and adds a salt to the cache. On a public site that means a session and a cache entry for every anonymous page view and every crawler request.

The rendering servlets don't output any of Roller's own forms, so they have no use for a salt. This change makes the filter pass requests under /roller-ui/rendering/ straight through.

  • Two new tests: a rendering path gets no session and no salt, and a path that merely starts with the same letters still gets both.
  • I also built the WAR and ran it: pages, feeds, resources and search no longer set a cookie, and /roller-ui/login.rol still does.

Comment posting is unaffected. The comment form posts to the entry permalink and is forwarded to the comment servlet, and ValidateSaltFilter does not run on forwards, so comments have never been salt-checked. A commenter still gets a session from the comment authenticator when the form loads. Checked on Jetty before and after for an anonymous visitor and a signed-in user (accepted in all four runs), and now covered by NewUserJourneyIT and SaltConfigurationTest.

LoadSaltFilter is mapped to /roller-ui/* and has run on forwards as well as requests since apache#167. Weblog pages, feeds, resources and searches are forwarded to the rendering servlets under /roller-ui/rendering/, so each one now called getSession(true) and put a salt in the cache, for every anonymous visitor and crawler. The rendering servlets output none of Roller's own forms, so the filter now passes those requests straight through.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐞Claude Issue: 1 inline comment posted.

The public comment form has no salt and posts to the entry permalink, which is forwarded to the comment servlet under /roller-ui/rendering. ValidateSaltFilter is mapped to direct requests only, so it never sees that forward; the new SaltConfigurationTest case pins that mapping, because adding FORWARD to it would reject comments from anyone with a session. LoadSaltFilterTest now also covers the forwarded comment POST, which no longer gets a session or a salt.
The journey now comments on the published entry twice through the real form: once as the signed-in author and once from a fresh browser context with no cookies. Both comments must be accepted without a salt. It also checks that reading the weblog front page leaves the visitor without a JSESSIONID cookie, which fails on master and passes with the LoadSaltFilter change.
The comment said the rendering servlets contain none of Roller's forms, which overlooks the comment form. It now says that form submits no salt and is not checked for one.

@snoopdave snoopdave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mraible
mraible merged commit ca47508 into apache:master Nov 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants