🐛 Fixed paginated sitemaps returning 404 for large sites#25796
🐛 Fixed paginated sitemaps returning 404 for large sites#25796kevinansfield merged 1 commit intomainfrom
Conversation
fixes https://linear.app/ghost/issue/BER-3152 The static-theme middleware had a hardcoded list of sitemap URLs that should fall through to Ghost's sitemap handler. This list only included the first page of each sitemap type (e.g., /sitemap-posts.xml) but not paginated sitemaps (e.g., /sitemap-posts-2.xml). For sites with more than 50k posts, the sitemap index correctly links to paginated files, but requests for those files were being blocked by the static-theme middleware because they weren't in the fallthrough list. The fix replaces the hardcoded list with a regex pattern that matches all paginated sitemap URLs (sitemap-{type}-{page}.xml).
WalkthroughThe changes introduce a new helper function Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ghost/core/test/unit/frontend/web/middleware/static-theme.test.js (1)
429-488: Consider adding tests for remaining sitemap types.While the current tests provide good coverage for the main use cases, consider adding tests for:
- The
pagestype: The regex includespages, but there's no test for/sitemap-pages-2.xml- The
userstype: Ifusersis a valid sitemap type, add a test for/sitemap-users-2.xml- The
/sitemap.xslfile: This is in the hardcoded fallthrough list but lacks a dedicated test- Negative test case: Verify that invalid patterns like
/sitemap-invalid-2.xmlcorrectly receivefallthrough: false📝 Example test cases for additional coverage
Add these tests to the "fallthrough behavior" describe block:
it('should set fallthrough to true for /sitemap.xsl', function (done) { req.path = '/sitemap.xsl'; staticTheme()(req, res, function next() { activeThemeStub.calledTwice.should.be.true(); expressStaticStub.called.should.be.true(); const options = expressStaticStub.firstCall.args[1]; options.should.have.property('fallthrough', true); done(); }); }); it('should set fallthrough to false for invalid sitemap types like /sitemap-invalid-2.xml', function (done) { req.path = '/sitemap-invalid-2.xml'; staticTheme()(req, res, function next() { activeThemeStub.calledTwice.should.be.true(); expressStaticStub.called.should.be.true(); const options = expressStaticStub.firstCall.args[1]; options.should.have.property('fallthrough', false); done(); }); });
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
ghost/core/core/frontend/web/middleware/static-theme.jsghost/core/test/unit/frontend/web/middleware/static-theme.test.js
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-23T15:44:52.549Z
Learnt from: 9larsons
Repo: TryGhost/Ghost PR: 21866
File: ghost/core/core/server/web/admin/middleware/serve-auth-frame-file.js:10-19
Timestamp: 2025-04-23T15:44:52.549Z
Learning: The existing implementation in `ghost/core/core/server/web/admin/middleware/serve-auth-frame-file.js` using `path.parse(req.url).base` is secure against path traversal attacks as it properly extracts only the filename component without any directory parts.
Applied to files:
ghost/core/core/frontend/web/middleware/static-theme.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Acceptance tests (Node 22.18.0, mysql8)
- GitHub Check: Legacy tests (Node 22.18.0, mysql8)
- GitHub Check: Legacy tests (Node 22.18.0, sqlite3)
- GitHub Check: Ghost-CLI tests
- GitHub Check: Lint
- GitHub Check: Unit tests (Node 22.18.0)
- GitHub Check: Acceptance tests (Node 22.18.0, sqlite3)
- GitHub Check: Cursor Bugbot
- GitHub Check: Build & Push Docker Image
🔇 Additional comments (3)
ghost/core/core/frontend/web/middleware/static-theme.js (2)
58-82: Well-structured helper function.The
isFallthroughFilefunction is well-organized with clear comments and a logical flow. The separation of hardcoded fallthrough files and pattern matching makes the code maintainable.
77-77: The regex is correct as written.The pattern
/^\/sitemap-(posts|pages|tags|authors|users)(-\d+)?\.xml$/correctly matches all sitemap types Ghost generates. Theusersproperty is set on the manager (as an alias toauthors) in site-map-manager.js, and theverifyResourceTypemiddleware validates against existing manager properties. Pagination constraints are already enforced in the handler (rejecting page 1 and null content).Likely an incorrect or invalid review comment.
ghost/core/test/unit/frontend/web/middleware/static-theme.test.js (1)
429-488: Good test coverage for paginated sitemaps.The new tests effectively verify that paginated sitemap URLs correctly receive
fallthrough: true. The tests cover multiple resource types (posts, tags, authors) and different page numbers (2, 99), confirming the regex pattern works as intended.
kevinansfield
left a comment
There was a problem hiding this comment.
There's a lot of duplication in the test file that could be simplified but the fix itself looks fine 👌
…#89) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/sredevopsorg/ghost-on-kubernetes](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes) | minor | `v6.10.1` → `v6.19.1` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>sredevopsorg/ghost-on-kubernetes (ghcr.io/sredevopsorg/ghost-on-kubernetes)</summary> ### [`v6.19.1`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.19.1) #### What's Changed - Bump version and appVersion in Chart.yaml by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​628](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/628) - chore(deps): update node.js to [`a749bc9`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/a749bc9) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​625](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/625) - chore(deps): update gcr.io/distroless/nodejs22-debian13:debug-nonroot docker digest to [`b9af496`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/b9af496) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​631](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/631) - chore(deps): update gcr.io/distroless/nodejs22-debian13:latest docker digest to [`d2ba14a`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/d2ba14a) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​632](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/632) - Change Ghost installation directory to /var/lib/ghost by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​634](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/634) - Change runtime image to debug-nonroot and an updated entrypoint by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​637](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/637) - chore(deps): update node.js to [`a749bc9`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/a749bc9) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​636](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/636) #### From upstream [@​tryghost](https://redirect.github.com/tryghost) 6.19.1 [Latest](https://redirect.github.com/TryGhost/Ghost/releases/latest) @​[Ghost-Slimer](https://redirect.github.com/Ghost-Slimer) Ghost-Slimer released this 1 hour ago · [4 commits ](https://redirect.github.com/TryGhost/Ghost/compare/v6.19.1...main)to main since this release [ v6.19.1](https://redirect.github.com/TryGhost/Ghost/tree/v6.19.1) [TryGhost/Ghost@`af0f06d`](https://redirect.github.com/TryGhost/Ghost/commit/af0f06d49809e7504f9ab85380037290019f79ba) [ Commits](https://redirect.github.com/TryGhost/Ghost/compare/v6.19.0...v6.19.1) 🔒 Fixed SQL injection in Content API slug filter ordering - Fabien O'Carroll 🐛 Added explanatory message when linking to hidden/deleted comments ([TryGhost/Ghost#26390](https://redirect.github.com/TryGhost/Ghost/pull/26390)) - Kevin Ansfield **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.17.0...v6.19.1> ### [`v6.17.0`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.17.0) #### What's Changed - Update helm-release.yaml for chart-releaser versioning by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​612](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/612) - chore: update Dockerfile to remove shell usage for OCI compatibility by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​624](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/624) - chore(deps): update github/codeql-action action to v4.32.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​614](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/614) - chore(deps): update docker/login-action action to v3.7.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​615](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/615) - chore(deps): update gcr.io/distroless/nodejs22-debian13:debug-nonroot docker digest to [`cb69988`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/cb69988) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​616](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/616) - chore(deps): update gcr.io/distroless/nodejs22-debian13:latest docker digest to [`8b6e2a8`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/8b6e2a8) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​617](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/617) - chore(deps): update step-security/harden-runner action to v2.14.1 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​613](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/613) - chore(deps): update node.js to [`a749bc9`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/a749bc9) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​622](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/622) - chore(deps): update github/codeql-action action to v4.32.2 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​621](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/621) - chore(deps): update step-security/harden-runner action to v2.14.2 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​623](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/623) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.14.0...v6.17.0> ### [`v6.14.0`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.14.0) #### What's Changed - Refactor: Extract settings Ghost version into single action by [@​ktlast](https://redirect.github.com/ktlast) in [#​601](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/601) - Add checkout step to Docker manifest merge workflow by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​608](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/608) - chore(deps): update github/codeql-action action to v4.31.11 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​610](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/610) - chore(deps): update actions/checkout action to v6.0.2 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​609](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/609) #### CHanges from upstream [@​tryghost](https://redirect.github.com/tryghost) ✨ Released automatic domain warm up - Sam Lord 🎨 Changed from Stripe checkout to Stripe billing portal ([TryGhost/Ghost#25887](https://redirect.github.com/TryGhost/Ghost/pull/25887)) - Sam Lord 🐛 Fixed Analytics Overview dates to use site timezone instead of UTC ([TryGhost/Ghost#25942](https://redirect.github.com/TryGhost/Ghost/pull/25942)) - Chris Raible 🐛 Allowed complimentary members to upgrade to a paid plan ([TryGhost/Ghost#25890](https://redirect.github.com/TryGhost/Ghost/pull/25890)) - Leif Singer 🐛 Fixed member name not being trimmed in Portal ([TryGhost/Ghost#25924](https://redirect.github.com/TryGhost/Ghost/pull/25924)) - Igor Balos 🐛 Fixed complimentary members being unable to view offers ([TryGhost/Ghost#25889](https://redirect.github.com/TryGhost/Ghost/pull/25889)) - Leif Singer 🐛 Fixed paginated sitemaps returning 404 for large sites ([TryGhost/Ghost#25796](https://redirect.github.com/TryGhost/Ghost/pull/25796)) - John O'Nolan 🐛 Fixed email-only posts stuck as "sent" after limit/verification failure - Kevin Ansfield 🐛 Fixed email-only posts stuck as "sent" after limit/verification failure - Kevin Ansfield 🐛 Fixed email size check not working for Contributors ([TryGhost/Ghost#25884](https://redirect.github.com/TryGhost/Ghost/pull/25884)) - Kevin Ansfield 🐛 Fixed wrongly caching admin html - Murat Çorlu **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.13.1...v6.14.0> ### [`v6.13.1`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.13.1) #### New contributors [@​ktlast](https://redirect.github.com/ktlast) #### What's Changed - chore(deps): update gcr.io/distroless/nodejs22-debian13:latest docker digest to [`64ebedc`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/64ebedc) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​594](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/594) - chore(deps): update gcr.io/distroless/nodejs22-debian13:debug-nonroot docker digest to [`7f39dab`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/7f39dab) - autoclosed by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​593](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/593) - Helm chart by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​597](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/597) - chore: update Helm chart and documentation for Ghost deployment by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​599](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/599) - chore(deps): update github/codeql-action action to v4.31.10 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​596](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/596) - chore(deps): update node.js to [`0457d8a`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/0457d8a) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​600](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/600) - chore(deps): update gcr.io/distroless/nodejs22-debian13:debug-nonroot docker digest to [`80d460e`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/80d460e) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​602](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/602) - chore(deps): update gcr.io/distroless/nodejs22-debian13:latest docker digest to [`8d51366`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/8d51366) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​603](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/603) - chore: update Helm chart metadata and documentation for Ghost deployment by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​604](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/604) - chore: update Helm release workflow and chart metadata for Ghost depl… by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​605](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/605) - Update helm-release.yaml to skip GitHub release by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​606](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/606) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.12.0...v6.13.1> ### [`v6.12.0`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.12.0) [Compare Source](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/compare/v6.11.0...v6.12.0) #### What's Changed - Remove unnecessary Docker image tags by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​591](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/591) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.11.0...v6.12.0> ### [`v6.11.0`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.11.0) [Compare Source](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/compare/v6.10.3...v6.11.0) #### What's Changed - chore(deps): update step-security/harden-runner action to v2.14.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​580](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/580) - chore(deps): update github/codeql-action action to v4.31.9 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​584](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/584) - chore(deps): update docker/setup-buildx-action action to v3.12.0 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​585](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/585) - chore(deps): update node.js to [`5efa41b`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/5efa41b) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​588](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/588) - Delete .github/dependabot.yml by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​589](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/589) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.10.3...v6.11.0> ### [`v6.10.3`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/releases/tag/v6.10.3) [Compare Source](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/compare/v6.10.1...v6.10.3) #### What's Changed - Change permissions and update package keywords by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​574](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/574) - Update Dockerfile-dev for Node version and base image changes by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​575](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/575) - Update Ghost on Kubernetes to version 6.0 by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​576](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/576) - chore(deps): update node.js to [`9c8ee5b`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/9c8ee5b) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​577](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/577) - chore(deps): update node.js to [`5283864`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/5283864) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​578](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/578) - chore(deps): update node.js to [`abd317c`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/abd317c) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​579](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/579) - chore(deps): update github/codeql-action action to v4.31.8 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​581](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/581) - chore(deps): update github artifact actions (major) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​582](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/582) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.10.1...v6.10.3> #### What's Changed - Change permissions and update package keywords by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​574](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/574) - Update Dockerfile-dev for Node version and base image changes by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​575](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/575) - Update Ghost on Kubernetes to version 6.0 by [@​ngeorger](https://redirect.github.com/ngeorger) in [#​576](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/576) - chore(deps): update node.js to [`9c8ee5b`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/9c8ee5b) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​577](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/577) - chore(deps): update node.js to [`5283864`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/5283864) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​578](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/578) - chore(deps): update node.js to [`abd317c`](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/commit/abd317c) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​579](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/579) - chore(deps): update github/codeql-action action to v4.31.8 by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​581](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/581) - chore(deps): update github artifact actions (major) by [@​renovate](https://redirect.github.com/renovate)\[bot] in [#​582](https://redirect.github.com/sredevopsorg/ghost-on-kubernetes/pull/582) **Full Changelog**: <sredevopsorg/ghost-on-kubernetes@v6.10.1...v6.10.3> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/mwgustin/homeops). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4yIiwidXBkYXRlZEluVmVyIjoiNDMuMTUuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fixes https://linear.app/ghost/issue/BER-3152
Summary
/sitemap-posts-2.xml) returned 404 for sites with more than 50k postsProblem
Sites with more than 50,000 posts get paginated sitemaps. The sitemap index (
/sitemap.xml) correctly contains links to paginated files like/sitemap-posts-2.xml. However, when browsers or crawlers request these paginated URLs, they receive a 404 error.Root Cause: The
static-theme.jsmiddleware had a hardcoded list of fallthrough files that only included the first page of each sitemap type (e.g.,/sitemap-posts.xml). Paginated URLs like/sitemap-posts-2.xmlwere not in this list, so the middleware tried to serve them from the theme folder, failed, and returned 404 instead of passing the request to Ghost's sitemap handler.Solution
Replaced the hardcoded sitemap URL list with a regex pattern that matches all paginated sitemap URLs:
/^\/sitemap-(posts|pages|tags|authors|users)(-\d+)?\.xml$/Test plan
Note
Improves sitemap handling in the static theme middleware to ensure Ghost-generated sitemaps are served correctly.
isFallthroughFileto centralize fallthrough logic forrobots.txt,sitemap.xml,sitemap.xsl, andsitemap-{posts|pages|tags|authors|users}(-page).xmlforwardToExpressStaticto useisFallthroughFileinstead of a hardcoded listsitemap-posts-2.xml,sitemap-posts-99.xml,sitemap-tags-3.xml,sitemap-authors-2.xml) and validates fallthrough remains false for other static filesWritten by Cursor Bugbot for commit 266777e. This will update automatically on new commits. Configure here.