Skip to content

fix: exclude static assets from markdown edge function#176

Merged
JakeSCahill merged 1 commit into
mainfrom
fix/serve-markdown-static-assets
May 18, 2026
Merged

fix: exclude static assets from markdown edge function#176
JakeSCahill merged 1 commit into
mainfrom
fix/serve-markdown-static-assets

Conversation

@JakeSCahill
Copy link
Copy Markdown
Contributor

Summary

Fixes 500 errors on all static assets (JS, CSS, fonts, SVGs) caused by the serve-markdown edge function incorrectly processing asset requests.

Root Cause

The serve-markdown.js edge function runs on /* (all paths) to enable markdown content negotiation. However, when browsers sent Accept: text/plain headers for static assets, the edge function attempted to process them as markdown files, causing:

  • /assets/js/site.js/assets/js/site.js/index.md
  • Result: 500 errors for all JS, CSS, fonts, and images

Changes

serve-markdown.js:

  • Add static asset exclusion list checking file extensions before markdown processing
  • Immediately bypass the edge function for .js, .css, .woff, .ttf, .svg, .png, .jpg, .json, etc.
  • Prevents the edge function from attempting to serve markdown versions of static files

Impact

Before: All static assets return 500 errors, completely breaking site functionality

  • No JavaScript loads
  • No CSS styling
  • No fonts render
  • No images/icons display

After: Static assets load correctly with 200 status codes while markdown content negotiation continues to work for documentation pages

Testing

  • ✅ Static assets (JS/CSS/fonts/images) load with 200 status
  • ✅ Markdown content negotiation still works for docs pages with Accept: text/markdown
  • ✅ No circular edge function invocations on asset requests

Fixes the 500 errors reported on autocomplete-js.js, site.js, site.css, Inter fonts, IBM Plex Mono fonts, and SVG icons.

🤖 Generated with Claude Code

Prevents 500 errors on JS, CSS, fonts, and images by skipping markdown processing for static assets. The edge function was incorrectly attempting to serve markdown versions of asset files when browsers sent Accept: text/plain headers.

Fixes static asset loading failures causing:
- autocomplete-js.js 500 errors
- site.js and site.css 500 errors
- Font files (Inter, IBM Plex Mono) 500 errors
- SVG and image 500 errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@JakeSCahill JakeSCahill requested a review from a team as a code owner May 18, 2026 14:30
@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for redpanda-documentation ready!

Name Link
🔨 Latest commit 31d06de
🔍 Latest deploy log https://app.netlify.com/projects/redpanda-documentation/deploys/6a0b229c89118b0008ba7b68
😎 Deploy Preview https://deploy-preview-176--redpanda-documentation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92 (🟢 up 10 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 83 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@JakeSCahill JakeSCahill merged commit 343926e into main May 18, 2026
3 of 5 checks passed
@JakeSCahill JakeSCahill deleted the fix/serve-markdown-static-assets branch May 18, 2026 14:31
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.

2 participants