Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Feb 1, 2026

Problem

  1. Go to https://npmx.dev/lodash
  2. Click code and select a file
  3. Reload page

Code viewer 404s on direct URL access: https://npmx.dev/code/lodash/v/4.17.23/_apply.js

Cause

server/routes/[...path].get.ts catch-all intercepts all requests and throws 404 for non .well-known/skills paths.

Fix

Move to middleware pattern - can pass through non-matching requests instead of throwing.

  • server/routes/[...path].get.ts (104 lines) → server/middleware/well-known-skills.ts (55 lines)

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 1, 2026 11:02am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 1, 2026 11:02am
npmx-lunaria Ignored Ignored Feb 1, 2026 11:02am

Request Review

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... this is problematic as it probably interferes with caching 🤔

could we instead do the parsing, and then redirect somewhere else, to an endpoint that can be cached?

@danielroe danielroe changed the title fix: SSR 404 on code viewer direct URL access fix: prevent 404 on code viewer direct URL access Feb 1, 2026
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging as a hotfix, but we should revisit

@danielroe danielroe added this pull request to the merge queue Feb 1, 2026
Merged via the queue into npmx-dev:main with commit d6e2e1a Feb 1, 2026
13 of 16 checks passed
@onmax
Copy link
Contributor Author

onmax commented Feb 1, 2026

For explicit ISR config, we could add:

'/:pkg/.well-known/skills/**': { isr: 3600 },
'/:scope/:pkg/.well-known/skills/**': { isr: 3600 },

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