Skip to content

Root-relative asset URLs ignore BASE_URL — myst-theme.css, favicon and the service-worker scope 404 on every page #56

Description

@mmcky

Every page on the deployed site requests several assets with root-relative URLs that omit the /lecture-wasm/ prefix, so they 404. Found while driving the site in a headless browser to validate QuantEcon/data-lectures#51.

One cause, four symptoms. The generated page head emits /-rooted hrefs while the site is served from BASE_URL=/lecture-wasm, and there is no <base> tag to rebase them — grep -c "<base " returns 0.

Requested Result Correct URL Result
https://quantecon.github.io/myst-theme.css 404 (9115 B HTML error page) /lecture-wasm/myst-theme.css 200, 36 bytes
https://quantecon.github.io/favicon.ico 404 /lecture-wasm/favicon.ico 200
skip-link target /french-rev#top 404 /lecture-wasm/french-rev#top 200
service worker scope https://quantecon.github.io/ registration fails /lecture-wasm/service-worker.js 200

Sampled 10 pages: the root-relative /myst-theme.css appears on 10 of 10. Confirmed both from the served HTML and from document.styleSheets in the browser, which resolves it to https://quantecon.github.io/myst-theme.css.

Impact is small but non-zero

Worth being precise so this isn't over-prioritised. The correct myst-theme.css is a 36-byte placeholder — /* No Custom Stylesheet Provided */ — so there is no visual impact. What you get is console noise plus two wasted requests per page load (404 ×2 and net::ERR_ABORTED ×2, observed on french-rev/, / and cobweb/).

The service-worker one is different in kind: the browser reports Failed to register a ServiceWorker for scope ('https://quantecon.github.io/') with script ('…/service-worker.js?enableCache=false') while the correctly-prefixed script serves 200. JupyterLite registering at root scope rather than the site's base is worth checking separately — it may affect offline/caching behaviour rather than being purely cosmetic.

Not caused by the recent data migration

gh pr view 55 --json files shows #55 touched only lectures/french_rev.md and six dataset files. This is a pre-existing mystmd / quantecon-theme build behaviour.

Relationship to #42

Different cause, and they should not be conflated: #42 is the piplite warehouse 404 (/lecture-wasm/pypi/all.json), which fires on kernel start. These four fire on page load. Anyone opening the network tab sees several 404s at once and could easily read them as one problem.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions