Caddy in reverse proxy and Nginx as front-end

Hello,

I have other web services on my server and I would like to keep my Nginx web service as a front end.

I try to change the address and the listening port (127.0.0.1:10000 for example) but I can’t find the values to specify in the .env file for docker.

Thank for your help.

I tried some change in firezone/docker-compose.yml but not working :

caddy:
    image: caddy:2
    volumes:
      - ${FZ_INSTALL_DIR:-.}/caddy:/data/caddy
    # See Caddy's documentation for customizing this line
    # https://caddyserver.com/docs/quick-starts/reverse-proxy
    command:
      - /bin/sh
      - -c
      - |
        cat <<EOF > /etc/caddy/Caddyfile && caddy run --config /etc/caddy/Caddyfile
        {
          http_port 1120  
          https_port 1121
          auto_https off
        }
        localhost {
          log
          bind 127.0.0.1
          reverse_proxy * 172.25.0.100:${PHOENIX_PORT:-13000}
          #${TLS_OPTS:-}
        }
        EOF
    network_mode: "host"
    deploy:
      <<: *default-deploy

This might be relevant: Cannot access dockerized Web UI from nginx proxy · Issue #1349 · firezone/firezone · GitHub

1 Like

I did this by ripping caddy entirely out of the docker-compose then exposed port 13000 in the firezone service to direct nginx to.

Thank for your reply. Do you have a configuration to provide ?

It helped me. :slightly_smiling_face:

  • extract from my .env file configuration
VERSION=0.7.27
EXTERNAL_URL=http://localhost:81

# [...]

TLS_OPTS="tls internal {
                on_demand
              }"
  • extract from my docker-compose.yml file configuration
# Comment on the block of lines about caddy service

# ...

firezone:
    image: firezone/firezone:${VERSION:-latest}
    ports:
      - ${WIREGUARD_PORT:-51820}:${WIREGUARD_PORT:-51820}/udp
      - 127.0.0.1:81:13000                                        # ADD THIS LINE

Then configure your Nginx files in reverse proxy on 127.0.0.1:81.

sure, check out the templates directory here for my ansible for it: infra-configuration/ansible/roles/firezone at main · jitsi/infra-configuration · GitHub