Skip to content

[Question] Caddy Forward proxy behind another Caddy reverse proxy? #145

Open

Description

@maxiride

Since modifying our main caddy server is a no-go, will the plugin work if placed behind another caddy reverse proxy? If so how should the forward proxy be configured?

Client --> Caddy A -- reverse proxy --> Caddy B forward proxy --> internet

Caddy A hypotetical configuration:

example.com {
    handle_path /forward/* {
        reverse_proxy caddy_B:80
    }
}

Caddy B hypotetical

:80 {
   forward_proxy
}

Activity

  1. mholt commented on Dec 2, 2024

    @mholt
    Member

    The client to a forward proxy (Caddy A in your example) needs to support forward proxies. I believe the HTTP(S)_PROXY env var(s) can do this, but I haven't played with this myself.

  2. maxiride commented on Dec 3, 2024

    @maxiride
    Author

    Oh actually we have a setting for this in the reverse_proxy: https://caddyserver.com/docs/modules/http.reverse_proxy.transport.http#forward_proxy_url or Caddyfile: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#forward_proxy_url

    That's nice, and I admit I missed it while reading the documentation.
    However, the forward_proxy_url option is a child of the transport rules of the reverse_proxy directive. AS-IS from the documentation it's my understanding that the option allows to reach a specific upstream through the defined forward proxy url.

    My question concern being able to reach any destination through the forward proxy (as any forward proxy usually allows), with the caveat that the forward proxy url to use must point to our main Caddy instance, hence the idea of putting it behind a reverse proxy.

    Ideally, in a flexible environment, I would simply spin up a new caddy instance with the forward proxy plugin and bind it to a different WAN IP (so to not disrupt the main Caddy), but that would touch the firewall area complicating more the matter (administratively speaking).


    The client to a forward proxy (Caddy A in your example) needs to support forward proxies.

    Of course, but luckily many applications have built-in support.

  3. Zetanova commented on Apr 16, 2026

    @Zetanova

    this resolves for me this issue
    #193

    I wanted simply route *.local domains without DNS or hosts entries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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