Skip to content

Fix module page restore after full page reload (Ctrl+F5) - #1737

Open
sanchez90 wants to merge 1 commit into
webmin:masterfrom
sanchez90:fix/goto-restore-empty-request-uri
Open

Fix module page restore after full page reload (Ctrl+F5)#1737
sanchez90 wants to merge 1 commit into
webmin:masterfrom
sanchez90:fix/goto-restore-empty-request-uri

Conversation

@sanchez90

Copy link
Copy Markdown

Fix module page restore after full page reload (Ctrl+F5)

Fixes: #1736

Problem

After a full page reload (Ctrl+F5), authentic-theme sometimes fails to restore
the module page and lands on the dashboard instead.

Root cause

The one-shot "goto" file (written on ?xnavigation=1 redirects to /) is
read and deleted by init_vars() via get_theme_temp_data('goto'). A
background/non-CGI request with an empty REQUEST_URI can consume this
file before the real / request runs init_vars(), so nav_detector() finds
no goto target and falls back to /sysinfo.cgi.

This is a server-side race; it is distinct from (and complementary to) the
existing pragma_no_cache logic, which only addresses the browser-side
heuristic cache of the root page.

Fix

Only consume the goto file on a real page request (when REQUEST_URI is
present). Background requests with an empty REQUEST_URI leave the file
untouched, so the actual / request still finds it.

Testing

Reproduced on Webmin 2.660 / authentic-theme 26.60 with a custom module:

  • Before: Ctrl+F5 on /mod/ lands on /sysinfo.cgi (goto consumed by an
    empty-REQUEST_URI background request).
  • After: Ctrl+F5 on /mod/ restores /mod/.

Verified that official modules (e.g. /sshd/) continue to restore correctly.

Only consume the one-shot goto file on a real page request (when REQUEST_URI
is present). A background request with an empty REQUEST_URI could otherwise
read and delete the goto file before the "/" request that follows an
?xnavigation=1 redirect, breaking page restore after Ctrl+F5.
@iliaross

iliaross commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Hello,

  • (goto consumed by an empty-REQUEST_URI background request).

I wonder what would cause REQUEST_URI to be empty. I remember you mentioned that it could happen in the case of a background process. Yet, you never mentioned which background process actually triggers load_theme_library.

I'm not saying the fix is incorrect in principle, and I'm aware of the race in various scenarios. But, I'd prefer to fully understand the reasons why one of the other changes was made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module page is not restored after a full page reload (Ctrl+F5)

2 participants