Skip to content

fix: CSS loading, asset URL rewriting, and nginx encoding errors with proxy gateways #30

Description

@oto-macenauer-absa

Describe the bug

Three related bugs affecting deployed and embedded instances of knowledge-base:

  1. Broken asset links on sub-paths — Root-relative url() references in CSS bundles (fonts, images) resolve incorrectly when served from /knowledge-base/{slug}/_astro/, producing 404s in deployed environments.
  2. CSS layer ordering conflict — Starlight's heading font sizes are overridden on direct page loads because Tailwind's @layer base is not declared before sub-app stylesheets are loaded, causing incorrect heading styles.
  3. nginx gzip encoding errors with proxy gateways — With gzip_proxied any, nginx re-encodes responses to proxies/gateways that already forwarded Accept-Encoding upstream, causing content encoding errors in browsers. FragmentGateway also transcodes responses causing Content-Encoding header leakage.

Area

  • Build pipeline (build-vite / fetch-apps / apps.json)
  • URL rewriting / chrome injection (transform)
  • Web-fragment embedding (host gateway / shadow DOM / routing)
  • Standalone site / nginx / Docker

Steps to Reproduce

Asset URL bug:

  1. Run npm run build (with sub-path prefix)
  2. Deploy behind nginx at /knowledge-base/
  3. Open any sub-app page — fonts/images 404

CSS layer bug:

  1. Run npm run build
  2. Navigate directly to a Starlight sub-app page
  3. Observe heading font sizes overridden by Tailwind base styles

nginx encoding bug:

  1. Deploy Docker container behind FragmentGateway
  2. Load a fragment page
  3. Observe ERR_CONTENT_DECODING_FAILED or garbled response

Expected state

  • All CSS asset url() references resolve correctly under sub-paths
  • Heading font sizes render as defined by the sub-app (Starlight) stylesheet
  • nginx does not double-encode responses; FragmentGateway receives clean, un-transcoded responses

Impact / Severity

High — breaks fonts, layout, and fragment embedding in deployed environments

Attachments / Evidence

Addressed by PR #29.

Related / References

Fixed in: #29

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions