nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Issues with dev server when running in Docker Container behind Caddy reverse proxy

Open Coffee2CodeNL opened this issue 3 weeks ago • 2 comments

https://github.com/nitrojs/nitro/blob/16f4167c12113d3c27e629d2388fd67df0b22859/src/core/dev-server/vfs.ts#L17

This line here is preventing some things from working (like retrieving _vfs.json) when running the Nuxt dev server in a docker container which is then accessed through another docker container running FrankenPHP which has the PWA reverse proxied.

Image

Nitro believes it is being reached from the 172.16.0.0/12 range, which is technically correct but in this case, still local and on an isolated network.

For implementation details, see: https://github.com/api-platform/api-platform/blob/api-platform-core/compose.yaml and https://github.com/api-platform/api-platform/blob/fa86b786ad5a104e784b5f88c775763266d74c88/api/frankenphp/Caddyfile#L60

Minor adjustments had been made by me to support Nuxt (replace Next.js in pwa folder with Nuxt, set up Dockerfile to run Nuxt with pnpm dev and a bind-mount of pwa folder to /app so any changes are picked up while developing so HMR can be used, and replace some stuff in the Caddyfile for matching Nuxt specific paths.

Any solutions?

I hoped to find an option somewhere to allow requests from an IP or IP Range besides ::1 or a 127.x.x.x address

Coffee2CodeNL avatar Dec 09 '25 22:12 Coffee2CodeNL

_vfs.json is mainly for debugging and should be accessed from the local IP.

What feature of Nuxt is broken? Is it devtools?

pi0 avatar Dec 09 '25 22:12 pi0

When I open devtools it tries to load that file, yes.

But I am working "locally", it's just running in a container

I haven't found much other side effects of this containerized setup yet, but I do reckon there are more issues I just haven't ran into yet

Coffee2CodeNL avatar Dec 09 '25 22:12 Coffee2CodeNL