Skip to content

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

@Coffee2CodeNL

Description

@Coffee2CodeNL

const isLocalRequest = ip && /^::1$|^127\.\d+\.\d+\.\d+$/.test(ip);

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions