Help With Guacamole Behind Caddy 2

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

Docker Compose with image “caddy:latest”

a. System environment:

Ubuntu 18.04 OS, Caddy running through Docker Compose

b. Command:

sudo docker-compose up -d caddy

c. Service/unit/compose file:

version: '3'
services:
#################################################################
#################################################################
#################################################################
  watchtower:
    container_name: watchtower
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always
#################################################################
#################################################################
  portainer:
    container_name: portainer
    image: portainer/portainer
    volumes: 
      - portainer_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "9000:9000"
    hostname: portainer
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  dashmachine:
    container_name: dashmachine
    image: rmountjoy/dashmachine:latest
    volumes:
      - ${storagepath}/dashmachine:/dashmachine/dashmachine/user_data
    hostname: dashmachine
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  caddy:
    container_name: caddy
    image: caddy:latest
    ports:
      - "80:80"
      - "443:443"
    environment:
      - ${domain}
    volumes:
      - ${storagepath}/caddy/config/Caddyfile:/etc/caddy/Caddyfile:ro
      - ${storagepath}/caddy/config/:/config/
      - ${storagepath}/caddy/data/:/data/
    hostname: caddy
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  cloudflare-ddns:
    container_name: cloudflare-ddns
    image: oznu/cloudflare-ddns:latest
    environment:
      - API_KEY=${cloudflareapikey}
      - ZONE=${domain}
      - SUBDOMAIN=monitor
      - PROXIED=true
    restart: always
#################################################################
#################################################################
  plex:
    image: linuxserver/plex
    container_name: plex
    environment:
      - TZ=US/New_York
      - PLEX_CLAIM=claim-9dxbkK-fXDjGsEyLgDSR
      - ADVERTISE_IP=http://192.168.1.11:32400/
      - PLEX_UID=1001
      - PLEX_GID=1004
      - UMASK_SET=002
    ports:
      - 32400:32400/tcp
      - 3005:3005/tcp
      - 8324:8324/tcp
      - 32469:32469/tcp
      - 1900:1900/udp
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
    hostname: homesrv
    volumes:
      - ${storagepath}/plex/config:/config
      - /mnt/storage/data/media:/data/media
      - /mnt/storage/data/plex_transcode:/data/plex_transcode
    hostname: plex
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  ombi:
    container_name: ombi
    image: linuxserver/ombi
    environment:
      - PUID=1012
      - PGID=1004
      - TZ=America/New_York
    volumes:
      - ${storagepath}/ombi/config:/config
    hostname: ombi
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  syncarr:
    container_name: syncarr
    image: syncarr/syncarr:latest
    environment:
      - RADARR_A_URL=https://radarr.homesrv.me
      - RADARR_A_KEY=${radarrkey}
      - RADARR_A_PROFILE=4K
      - RADARR_A_PATH=/data/media/4K/Movies/
      - RADARR_B_URL=https://radarr1080.homesrv.me
      - RADARR_B_KEY=${radarr1080key}
      - RADARR_B_PROFILE=HD
      - RADARR_B_PATH=/data/media/HDSD/Movies/
      - SYNCARR_BIDIRECTIONAL_SYNC=1
      - SYNC_INTERVAL_SECONDS=300
    restart: unless-stopped
#################################################################
  sonarr4K:
    container_name: sonarr4K
    image: linuxserver/sonarr:preview
    environment:
      - PUID=1003
      - PGID=1004
      - UMASK_SET=002
      - TZ=America/New_York
    volumes:
      - ${storagepath}/sonarr/config:/config
      - /mnt/storage/data:/data
    hostname: sonarr4K
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  sonarr1080:
    container_name: sonarr1080
    image: linuxserver/sonarr:preview
    environment:
      - PUID=1003
      - PGID=1004
      - UMASK_SET=002
      - TZ=America/New_York
    volumes:
      - ${storagepath}/sonarr1080/config:/config
      - /mnt/storage/data:/data
    hostname: sonarr1080
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  radarr4K:
    container_name: radarr4K
    image: linuxserver/radarr:nightly
    environment:
      - PUID=1002
      - PGID=1004
      - UMASK_SET=002
      - TZ=America/New_York
    volumes:
      - ${storagepath}/radarr/config:/config
      - /mnt/storage/data:/data
    hostname: radarr4K
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  radarr1080:
    container_name: radarr1080
    image: linuxserver/radarr:nightly
    environment:
      - PUID=1002
      - PGID=1004
      - UMASK_SET=002
      - TZ=America/New_York
    volumes:
      - ${storagepath}/radarr1080/config:/config
      - /mnt/storage/data:/data
    hostname: radarr1080
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  jackett:
    container_name: jackett
    image: linuxserver/jackett
    environment:
      - PUID=1004
      - PGID=1004
      - TZ=America/New_York
    volumes:
      - ${storagepath}/jackett/config:/config
      - /mnt/storage/data/torrents/blackhole:/data/torrents/blackhole
    hostname: jackett
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  bazarr:
    image: linuxserver/bazarr:development
    container_name: bazarr
    environment:
      - PUID=1005
      - PGID=1004
      - UMASK_SET=002
      - TZ=US/New_York
    volumes:
      - ${storagepath}/bazarr/config:/config
      - /mnt/storage/data/media/:/data/media
    hostname: bazarr
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  tautulli:
    container_name: tautulli
    image: linuxserver/tautulli
    environment:
      - PUID=1006
      - PGID=1004
      - TZ=America/New_York
    volumes:
      - ${storagepath}/tautulli/config:/config
      - /mnt/storage/data/tautulli_scripts:/data/tautulli_scripts
      - ${storagepath}/plex/config:/logs:ro
    hostname: tautulli
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    cap_add:
      - NET_ADMIN
    environment:
      - TZ=America/New_York
      - VIRTUAL_HOST=pi.${domain}
      - VIRTUAL_PORT=80
      - ServerIP=192.168.1.11
      - WEBPASSWORD=${piholepassword}
      - PROXY_LOCATION=pihole
    volumes:
      - ${storagepath}/pihole/etc-pihole:/etc/pihole
      - ${storagepath}/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "1080:80"
      - "10443:443"
    hostname: pihole
    networks:
      - caddy_net
    restart: always
#################################################################
  hass:
    container_name: hass
    image: homeassistant/home-assistant
    volumes:
      - ${storagepath}/home_assistant/config:/config
    hostname: hass
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  fireflyiii:
    container_name: fireflyiii
    image: jc5x/firefly-iii:latest
    volumes:
      - firefly_iii_export:/var/www/firefly-iii/storage/export
      - firefly_iii_upload:/var/www/firefly-iii/storage/upload
    env_file: firefly.env
    hostname: fireflyiii
    networks:
      - caddy_net
    depends_on: 
      - fireflyiiidb
    restart: unless-stopped
#################################################################
  fireflyiiidb:
    container_name: fireflyiiidb
    image: postgres:10-alpine
    environment:
      - POSTGRES_USER=firefly
      - POSTGRES_PASSWORD=${postgresfireflypassword}
    volumes:
      - firefly_iii_db:/var/lib/postgresql/data
    hostname: fireflyiiidb
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  nzbhydra2:
    container_name: nzbhydra2
    image: binhex/arch-nzbhydra2
    environment:
      - PUID=1009
      - PGID=1004
      - UMASK=002
    volumes:
      - ${storagepath}/nzbhydra/config:/config
      - /mnt/storage/data:/data
      - /etc/localtime:/etc/localtime:ro
    hostname: nzbhydra
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  qbittorrent4K:
    container_name: qbittorrent4K
    image: binhex/arch-qbittorrentvpn
    privileged: true
    environment:
      - VPN_PROV=pia
      - VPN_ENABLED=yes
      - VPN_USER=${piausername}
      - VPN_PASS=${piapassword}
      - LAN_NETWORK=192.168.1.0/24
      - NAME_SERVERS=1.1.1.1
      - WEBUI_PORT=8090
      - TZ=America/New_York
      - PUID=1007
      - PGID=1004
      - UMASK=002
      - STRICT_PORT_FORWARD=yes
    volumes:
      - ${storagepath}/qbittorrent4K/config:/config
      - /mnt/storage/data/torrents/:/data/torrents
      - /etc/localtime:/etc/localtime:ro
    hostname: qbittorrent4K
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  qbittorrent1080:
    container_name: qbittorrent1080
    image: binhex/arch-qbittorrentvpn
    privileged: true
    environment:
      - VPN_PROV=pia
      - VPN_ENABLED=yes
      - VPN_USER=${piausername}
      - VPN_PASS=${piapassword}
      - LAN_NETWORK=192.168.1.0/24
      - NAME_SERVERS=1.1.1.1
      - WEBUI_PORT=8090
      - TZ=America/New_York
      - PUID=1007
      - PGID=1004
      - UMASK=002
      - STRICT_PORT_FORWARD=yes
    volumes:
      - ${storagepath}/qbittorrent1080/config:/config
      - /mnt/storage/data/torrents/:/data/torrents
      - /etc/localtime:/etc/localtime:ro
    hostname: qbittorrent1080
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
  nzbget:
    container_name: nzbget
    image: linuxserver/nzbget
    environment:
      - PUID=1008
      - PGID=1004
      - TZ=America/New_York
    volumes:
      - ${storagepath}/nzbget/config:/config
      - /mnt/storage/data/usenet:/data/usenet
    hostname: nzbget
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  guac:
    container_name: guac
    image: oznu/guacamole
    volumes:
      - ${storagepath}/guac/config:/config
    hostname: guac
    networks:
      - caddy_net
#################################################################
#################################################################
  droppy:
    container_name: droppy
    image: silverwind/droppy
    volumes:
      - ${storagepath}/droppy/config:/config
      - /mnt/storage/data/droppy:/files/All Others
      - /mnt/storage/media:/files/media:ro
      - /mnt/storage/data/handbrake/output:/files/Handbrake Converted:ro
    hostname: droppy
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  handbrake:
    container_name: handbrake
    image: jlesage/handbrake
    volumes:
      - ${storagepath}/handbrake/config:/config:rw
      - /mnt/storage/data/media:/data/media:ro
      - /mnt/storage/data/handbrake/watch:/data/handbrake/watch:rw
      - /mnt/storage/data/handbrake/output:/data/handbrake/output:rw
    hostname: handbrake
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
  lan-play:
    container_name: lan-play
    image: spacemeowx2/switch-lan-play
    ports:
      - "11451:11451/udp"
      - "11451:11451/tcp"
    network_mode: host
    restart: unless-stopped
#################################################################
#################################################################
  whoami:
    container_name: whoami
    image: containous/whoami
    hostname: whoami
    networks:
      - caddy_net
    restart: unless-stopped
#################################################################
#################################################################
#################################################################
volumes:
  portainer_data:
  firefly_iii_export:
  firefly_iii_upload:
  firefly_iii_db:
#################################################################
#################################################################
#################################################################
networks:
  caddy_net:
    external: true

d. My complete Caddyfile or JSON config:

### caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile

{
    email brysep516@gmail.com
#    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

nginx.homesrv.me {
    reverse_proxy nginx:80
}

port.homesrv.me {
    reverse_proxy portainer:9000
}

pi.homesrv.me {
	redir / /admin
	reverse_proxy pihole:80
}

dash.homesrv.me {
	redir / /login
	reverse_proxy dashmachine:5000
}

taut.homesrv.me {
	reverse_proxy tautulli:8181
}

plex.homesrv.me {
	reverse_proxy plex:32400
}

ombi.homesrv.me {
	reverse_proxy ombi:3579
}

sonarr.homesrv.me {
	reverse_proxy sonarr4K:8989
}

sonarr1080.homesrv.me {
	reverse_proxy sonarr1080:8989
}

radarr.homesrv.me {
	reverse_proxy radarr4K:7878
}

radarr1080.homesrv.me {
	reverse_proxy radarr1080:7878
}

jackett.homesrv.me {
	reverse_proxy jackett:9117
}

bazarr.homesrv.me {
	reverse_proxy bazarr:6767
}

qbit.homesrv.me {
	reverse_proxy qbittorrent4K:8090
}

qbit1080.homesrv.me {
	reverse_proxy qbittorrent1080:8090
}

hydra.homesrv.me {
	reverse_proxy nzbhydra2:5076
}

nzb.homesrv.me {
	reverse_proxy nzbget:6789
}

nzb1080.homesrv.me {
	reverse_proxy nzbget1080:6789
}

droppy.homesrv.me {
	reverse_proxy droppy:8989
}

hand.homesrv.me {
	reverse_proxy handbrake:5800
}

hass.homesrv.me {
	reverse_proxy hass:8123
}

firefly.homesrv.me {
    reverse_proxy fireflyiii:8080
}

guac.homesrv.me {
    reverse_proxy guac:8080 {
        flush_interval -1
    }
}

3. The problem I’m having:

I can access the Guacamole web interface, but it doesn’t see my other computer on the network. I believe this is because it is seeing Caddy’s IP rather than my router’s.

4. Error messages and/or full log output:

“The remote desktop server is currently unreachable. If the problem persists, please notify your system administrator, or check your system logs.”

5. What I already tried:

As [mentioned in this post] (Reverse Proxy Guacamole), I’ve tried adding the redirect / /guacamole/ 308, but that throws me an error 404 with the description “The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.”

I also tried adding the RemoteIPValve statement to Guacamole’s server.xml, but no luck. These are the relevant portions:

         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               URIEncoding="UTF-8"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">

and

             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
        <Valve className="org.apache.catalina.valves.RemoteIpValve"
               internalProxies="192.168.48.1"
               remoteIpHeader="x-forwarded-for"
               remoteIpProxiesHeader="x-forwarded-by"
               protocolHeader="x-forwarded-proto" />

      </Host>
    </Engine>
  </Service>
</Server>

According to Portainer, the Guacamole container has the IP 192.168.48.2, while the gateway IP is 192.168.48.1

6. Links to relevant resources:

Chapter 4 of Guacamole’s user guide, which is about putting it behind a remote proxy, is here: https://guacamole.apache.org/doc/gug/proxying-guacamole.html

Hmm. I think you might also need to run guacd according to these instructions?

https://guacamole.apache.org/doc/gug/guacamole-docker.html

I don’t particularly think this is a Caddy issue, since you can see the site.

You can verify whether it’s a Caddy issue by publishing a port to guac and try using it directly temporarily.

You’re right :confused:

After exposing a port, I see it’s not a problem with Caddy.

I must’ve set something in my connection settings wrong, because after following a guide, I was able to get it working.

Thanks for the guidance!

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.