Add native support for showing real client IP when behind Cloudflare (or other reverse proxies)

Aperta
#5,248 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, typescript

Direzione di ricerca

Inizia tracciando come viene rappresentata la configurazione Settings > Traefik / Network e come viene generato /etc/dokploy/traefik/traefik.yml. Esamina gli entryPoints di Traefik per web e websecure, le origini IPv4/IPv6 di Cloudflare e la issue correlata #2349. Il lavoro è completato quando gli intervalli dei proxy attendibili possono essere configurati tramite Dokploy e persistono dopo la rigenerazione della configurazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
What problem will this feature address?

When an application is deployed behind Cloudflare (proxied DNS) or another reverse proxy, both Dokploy's dashboard and the request headers passed to deployed applications reflect Cloudflare's edge IP address rather than the end user's actual IP address.

This creates critical limitations:

  • Inability to perform accurate IP-based access control or allowlisting.
  • Inaccurate rate limiting at the application level.
  • Loss of visibility into actual traffic sources in application logs.

Current Workaround & Friction:
Currently, the only workaround is to SSH into the host server and manually edit Traefik's static configuration (/etc/dokploy/traefik/traefik.yml) to populate entryPoints.<name>.forwardedHeaders.trustedIPs with Cloudflare’s published IP ranges.

This approach is fragile because:

  1. It is not exposed or discoverable in the UI.
  2. Changes risk being silently overwritten whenever Dokploy regenerates the Traefik configuration.
  3. Cloudflare's IP ranges must be maintained manually or through out-of-band scripting.
Describe the solution you'd like

A native configuration toggle in the Dokploy settings (e.g., under Settings > Traefik / Network) to handle trusted reverse proxy headers automatically:

  1. Preset Options: A toggle to enable "Trust Proxy / Restore Real IP" with built-in presets:
    • Cloudflare: Automatically fetches and injects Cloudflare’s official IPv4 and IPv6 ranges (https://www.cloudflare.com/ips-v4 and /ips-v6).
    • Custom / Generic: A text input accepting user-defined CIDR ranges (for Cloudflare Tunnels, AWS ALB, custom NGINX, etc.).
  2. Persistence & Maintenance:
    • Ensure these entries are natively written into Traefik's entryPoints (web, websecure) so they persist across Dokploy updates or Traefik config regenerations.
    • Periodically auto-refresh Cloudflare's IP list (or sync on container restart).
  3. UI Visibility (Optional): Display the resolved real client IP in Dokploy dashboard logs and request analytics.
Describe alternatives you've considered
  • Manual traefik.yml modification + Cron script: Functional, but prone to breakage when Dokploy regenerates Traefik files.
  • Traefik Plugins (e.g., traefik-real-ip, Traefik Warp): Solves parts of the issue, but requires enabling Traefik's plugin system, which is currently unexposed in Dokploy.
Additional context
  • Potentially related to #2349 (IPv6 client IP reporting issues).
Will you send a PR to implement it?

Yes

Lingua principale
TypeScript
Stelle
38.2k
Fork
3.1k
Merge medio
1g 18h
PR unite (30g)
74

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Dokploy/dokploy

Tutte le issue di Dokploy/dokploy

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.