Skip to content

fix: add missing rewrites for marketing page PDF downloads #2696

@cursor

Description

@cursor

Issue

The 'Download as PDF' links on the following pages are broken:

The security pages (toms, dpa, hipaa, nda) work correctly.

Root Cause

The PDF download API (/api/md-to-pdf) fetches markdown from URLs like https://langfuse.com/terms.md. The Next.js rewrite rule /:path*.md/md-src/:path*.md maps this to /md-src/terms.md.

However, the marketing pages (terms, privacy, cookie-policy) are stored at content/marketing/*.mdx and get copied to public/md-src/marketing/*.md during build. So the actual file is at /md-src/marketing/terms.md, not /md-src/terms.md.

Fix

Add explicit rewrites for the marketing pages with PDF download links in next.config.mjs:

beforeFiles: [
  // Marketing pages: /X.md → /md-src/marketing/X.md
  // These pages live at content/marketing/*.mdx but are served at /*.md
  {
    source: "/support.md",
    destination: "/md-src/marketing/support.md",
  },
  {
    source: "/terms.md",
    destination: "/md-src/marketing/terms.md",
  },
  {
    source: "/privacy.md",
    destination: "/md-src/marketing/privacy.md",
  },
  {
    source: "/cookie-policy.md",
    destination: "/md-src/marketing/cookie-policy.md",
  },
  // ... rest of rewrites
]

Related to: langfuse/langfuse#LFE-8951

Metadata

Metadata

Assignees

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