Skip to content

Redirect / to the main page instead of serving it in place#27

Merged
tamnd merged 1 commit into
mainfrom
fix-mainpage-redirect
Jun 15, 2026
Merged

Redirect / to the main page instead of serving it in place#27
tamnd merged 1 commit into
mainfrom
fix-mainpage-redirect

Conversation

@tamnd

@tamnd tamnd commented Jun 15, 2026

Copy link
Copy Markdown
Owner

A served mirror whose entry point is a nested page lost all its CSS and images when opened at the root.

kage saves each page's asset links as mirror-relative paths (../_kage/...) computed for that page's own location. The serve handler answered / with the main page's bytes directly, so the browser resolved those relative URLs against / and 404ed every one. A developer.apple.com/documentation mirror, whose main page is developer.apple.com/documentation/index.html, landed at / completely unstyled.

Redirect / to the main page's canonical content path instead, the way the archive's W/mainPage redirect already does, so the browser navigates to the page's real URL and resolves its relative assets correctly. Kiwix was unaffected because it follows that redirect itself.

Verified on a real apple-docs ZIM: / now 302s to /developer.apple.com/documentation/index.html and the page's ../_kage/... stylesheets load 200.

The served main page broke its own CSS and images when the entry point
was a nested page. kage saves each page's asset links as mirror-relative
paths (../_kage/...) computed for that page's own location, but the
handler served the main page's bytes directly at /, so the browser
resolved those relative URLs against / and 404ed every one of them. A
developer.apple.com/documentation mirror landed at / with no styles.

Redirect / to the main page's canonical content path, the way the
archive's W/mainPage redirect already does, so the browser navigates to
the page's real URL and resolves its relative assets correctly. Kiwix
was unaffected because it follows that redirect itself.
@tamnd tamnd merged commit 2064ef9 into main Jun 15, 2026
9 checks passed
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.

1 participant