CADDY Reverse Proxy Support

jeffsui

Member
Dec 11, 2022
7
11
8
Hello,
I'm having some issues proxying Proxmox behind Caddy.

If I hit my box on its direct ip address the console opens fine.

If I hit the box via CADDY Proxmox loads fine but the console throws a wss://xxxx error


1731518997027.png

My assumption is that I'm missing some directive in caddy but I'm kind of at a loss. The only info I can find out there regards to nginx...


JSON:
{
    # debug
    admin 0.0.0.0:2019

    storage file_system {
        root /etc/caddy/storage
    }
}

# Define a snippet for the common TLS configuration
(tls_config) {
    tls {
        dns cloudflare {env.CLOUDFLARE_API_TOKEN}
        resolvers 1.1.1.1
        propagation_delay 30s
    }
}

# Define a snippet for the common reverse proxy configuration
(reverse_proxy_config) {
    reverse_proxy {
        transport http {
            tls_insecure_skip_verify
        }
    }
}

# Define a snippet for logging to console with DEBUG level
(log_debug) {
    log {
        output stdout
        level DEBUG
    }
}
# Audio Books

# Using a wildcard cert so i dont need to duplicate the stuff on the internet (i think).
# Cloudflare tunnel has its own cert so I think ican use mydomain.dev either remotely or locally and it
# should work
*.mydomain.dev {
    import tls_config

    
    @pve1 host pve1.mydomain.dev
    handle @pve1 {
        reverse_proxy https://192.168.1.3:8006 {
            transport http {
                tls_insecure_skip_verify
                tls_server_name pve1.mydomain.dev
            }
            header_up Host {host}
            header_up X-Real-IP {remote}
            header_up Connection "upgrade"
            header_up Upgrade {>Upgrade}
        }
    }

    @pve2 host pve2.mydomain.dev
    handle @pve2 {
        reverse_proxy https://192.168.1.4:8006 {
            transport http {
                tls_insecure_skip_verify
            }
            header_up Host {host}
            header_up X-Real-IP {remote}
            header_up Connection "upgrade"
            header_up Upgrade {>Upgrade}
        }
    }
    @pve3 host pve3.mydomain.dev pve3.mydomain.dev:8006
    handle @pve3 {
        reverse_proxy https://192.168.1.5:8006 {
            transport http {
                tls_insecure_skip_verify
            }
            header_up Host {host}
            header_up X-Real-IP {remote}
            header_up Connection "upgrade"
            header_up Upgrade {>Upgrade}
        }
    }

    @pve4 host pve4.mydomain.dev
    handle @pve4 {
        reverse_proxy https://192.168.1.20:8006 {
            transport http {
                tls_insecure_skip_verify
            }
            header_up Host {host}
            header_up X-Real-IP {remote}
            header_up Connection "upgrade"
            header_up Upgrade {>Upgrade}
        }
    }

    # Fallback for otherwise unhandled domains
    handle {
        abort
    }
}
 
Hi, noVNC (the console) uses websockets - as far as I know, reverse proxies do not support this by default - I once encountered the same issue when I configured nginx proxy manager for my Proxmox host. The solution was just to enable websocket support in the nginx proxy settings. I don't know how this can be enabled using Caddy, but there should be enough resources regarding this online. Let me know if that helps!