Files
next.js/test/development/basic/asset-prefix/fixture/pages/api/test-json.js
Mark KnichelandGitHub d2cfaf4a04 Fix issue with afterFiles rewrites not working when prefixed with assetPrefix (#68694)
This PR fixes two issues with the use of `assetPrefix`:

#1: https://github.com/vercel/next.js/issues/64710
`assetPrefix` needs to be handled in `dev`, `deploy`, and `start`. In
the current approach, only `dev` and `start` were handled, but a quirk
of the implementation caused rewrites for non-asset paths to not be able
to be used in `afterFiles` rewrites.

#2: When deploying Next.js (such as on Vercel), you need to add your own
`beforeFiles` rewrite for `/${assetPrefix}/_next/...` requests or
otherwise they would 404.

This PR creates an automatically added `rewrite` to `beforeFiles` that
handles the case for `dev`, `start`, and `deploy`, removes the existing
logic in `filesystem.ts`, and adds more tests to check the behavior.
2024-08-15 09:51:58 -07:00

4 lines
90 B
JavaScript

export default function handler(req, res) {
res.status(200).json({ message: 'test' })
}