Repository navigation
Take the site URL from setup or an administrator, not from the first request - #337
Merged
Merged
Conversation
When site.absoluteurl is empty, the installer's bootstrap step and the registration of the first administrator now save it from that request (scheme, host, port and context path). InitFilter no longer stores a request-derived absolute URL for the whole application. Instead it makes each request's URL available on its own thread for the length of that request, and getAbsoluteContextURL() falls back to it only while site.absoluteurl is unset, logging a warning once. Page, feed, site-wide and planet output that used the request's URL is not added to the rendering caches. The request URL now uses the request's scheme and keeps non-default ports, so HTTPS sites get https:// links. Install now receives the servlet request through ServletRequestAware, as Register already does, and its bootstrap checks use it in place of ServletActionContext. (cherry picked from commit 8032cff)
… admin's request While site.absoluteurl is unset, the page, feed, site-wide and planet caches now include the request's absolute URL in their keys instead of skipping the cache, so content built with one host name is only served to requests for that host name and caching keeps working. The first Roller UI request from a global administrator saves site.absoluteurl when it's still unset, which fills it in on sites upgraded without it.
snoopdave
reviewed
Nov 18, 2026
… only once A request now reads site.absoluteurl once, the first time it builds a link or a cache key, so its links and the key its content is cached under always agree even if an administrator sets the URL meanwhile. Content rendered outside a request isn't cached while the URL is unset, the cache warmup job skips its work until then, and the rendering caches are cleared when the URL is first saved. Saving the URL from setup or an administrator's request now uses compareAndSetProperty(), so when several requests try at once only the first one's URL is kept. Planet links also go through getAbsoluteContextURL() instead of reading the property directly.
While site.absoluteurl is unset, comment and approval notifications are still sent but leave out their links, since the only URL available is the host name of the request that caused them. Activation, invitation and pending entry emails exist to deliver a link, so they aren't sent: activation and invitation report why to the caller, and the pending entry notice logs a warning.
The planet sync task and the local feed fetcher store absolute links to each weblog. Until site.absoluteurl is set they can't build those links, so they skip their work instead of storing incomplete URLs.
The installer, the first administrator's registration and the first administrator request only save their URL as site.absoluteurl when its host looks like a public name. Loopback and private addresses, and host names without a dot such as localhost or a proxy's backend name, are left for an administrator to set under Server Administration > Configuration.
SmileysPlugin built its img tags once, with the URL of whichever request first loaded it, and reused them for every later request. It now keeps only the path and adds the current request's site URL when rendering, or the relative context path outside a request.
The log and error messages about an unset site URL now point to Server Admin > Configuration, matching the tab labels.
The planet sync task and local feed fetcher now wait for site.absoluteurl, so the test sets it, as a configured site would, and clears it afterwards.
Contributor
Author
|
A second review raised a few more points, now addressed in the latest commits:
|
…ring Adding a weblogger:<handle> planet subscription while the site URL is unset now tells the administrator to set the URL first instead of failing with a NullPointerException. The background updater still skips local feeds quietly. The subscription page also shows the message of a fetcher error that has no wrapped cause, rather than "null". When activation emails are required but can't be sent because the site URL is unset, registration is refused before the account is saved, so the username isn't taken by an account that can never be activated. The first administrator is still let through. If the activation email fails for any other reason, the welcome page shows an error instead of telling the visitor to check their email. Saving the site URL for the first administrator's registration and on an administrator's request is now best-effort for unchecked exceptions too, such as a lock timeout, as it already is in the installer. The concurrent site URL test restores the original value in a finally block, and the later-registrations test also asserts that compareAndSetProperty is not called.
snoopdave
reviewed
Nov 20, 2026
snoopdave
left a comment
Contributor
There was a problem hiding this comment.
Review of 32304dd3b: The current code addresses both earlier review points. The shared fix matches #320; the additional emoticon change is specific to this branch. This was a static review, with no build run.
Earlier comments: 2 of 2 resolved.
No new issues found.
snoopdave
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 6.1.x version of #320, including its per-host cache keys and the save from an administrator's request.
InitFilterno longer keeps the first request's URL as the site URL for the whole application. Each request's URL is available on its own thread for that request, andgetAbsoluteContextURL()falls back to it only whilesite.absoluteurlis unset, logging a warning once. A request reads the setting once, so its links and cache keys agree even if an administrator sets the URL meanwhile.site.absoluteurlwhen it's still unset and the host looks like a public name, usingcompareAndSetProperty()so only the first save is kept. On an upgraded 6.1.x site, which runs no installer step, the first admin page view fills it in. Local and private addresses, and host names without a dot such aslocalhost, are left for an administrator to set under Server Admin > Configuration, which the log and error messages point to.https://links.For 6.1.8 specifically: the ping queue runs outside any request, so pings are skipped (with a warning) until
site.absoluteurlis set. The emoticon plugin built its image tags once, with the URL of whichever request loaded it first; it now adds the current request's site URL when rendering, or the context path outside a request.WebloggerRuntimeConfig.setAbsoluteContextURLandInitFilter.getAbsoluteUrlare removed. CHANGES (#336) tells admins to set "Absolute URL to site".Changes from master:
InstallimplementsServletRequestAwarehere, as on master, and the tests usejavax.servlet.Tests:
InitFilterTest,InstallTest,RegisterSiteUrlTest,SiteUrlForAdminTest,SiteUrlWhileUnsetTest,MailUtilSiteUrlTest,PlanetSiteUrlTest,SmileysPluginSiteUrlTestand newPropertiesTestcases.mvn testpasses, and the Selenium integration tests pass. The master version was measured on a copy of a production site: no difference between the setting set and empty.A further review pass added these fixes:
weblogger:<handle>planet subscription tells the administrator to set the URL first instead of failing with a 500.