This repository is intended to verify that the host header is properly passed when reverse proxying another web server in a Next.js project.
This repository consists of three projects:
edge-middleware
- This project uses the edge middleware feature to return the content fromlocalhost:4000/foo
when accessed vialocalhost:3000/foo
.nextjs-rewrites
- This project accomplishes the same task as the above using the rewrites feature of the Next.js config.rewrite-target
- This project provides an API atlocalhost:4000/foo
that returns whatever host header it receives.
pnpm install
pnpm dev:edge-middleware # or pnpm dev:nextjs-rewrites
open http://localhost:3000/foo