fix: Fix css loading on direct links - #29
Closed
oto-macenauer-absa wants to merge 2 commits into
Closed
Conversation
oto-macenauer-absa
force-pushed
the
fix/css-loading
branch
from
July 31, 2026 13:15
84f3ba2 to
fdc0776
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #30
This pull request includes several important improvements and fixes related to asset handling, CSS layer ordering, and proxy/gateway compatibility. The main changes ensure that static assets and CSS are served correctly from sub-paths, fix CSS layer ordering issues that affected heading styles, and address problems with gzip encoding and header leakage when behind proxies or gateways.
Asset handling and build process:
scripts/build-vite.jsto rewrite root-relativeurl()references in CSS bundles so they resolve correctly when served from sub-paths (e.g.,/knowledge-base/{slug}/_astro/). This prevents broken asset links for fonts and images in deployed environments.writeFileSyncimport toscripts/build-vite.jsto support the CSS rewriting logic.CSS and layout fixes:
<style is:inline>@layer base;</style>declaration insrc/layouts/Base.astrobefore sub-app stylesheets are loaded. This ensures Tailwind's base layer is always declared first, fixing an issue where Starlight's heading font sizes were being overridden on direct page loads due to CSS layer ordering.Proxy/gateway compatibility and encoding:
gzip_proxiedfromanytooffinnginx.confto prevent nginx from gzip-encoding responses to proxies/gateways that already sentAccept-Encodingupstream, avoiding content encoding errors in browsers.add_header Cache-Control "no-transform" always;to the/knowledge-base/location innginx.confto instruct intermediate proxies (like FragmentGateway) not to transcode or re-encode responses, preventingContent-Encodingheader leakage.Dependency updates:
@astrojs/checkto version^0.9.10inpackage.json.Release notes