{
        email admin@zerolaghub.com
        auto_https disable_redirects
        admin 127.0.0.1:2019
        debug
        # Removed invalid auto_https directive
        # Default: redirects HTTP → HTTPS automatically

        servers :443 {
                timeouts {
                        read_body 120s
                }
        }
}

# ♦ PANEL - Pterodactyl Web Panel (LEGACY - do not migrate)
panel.zerolaghub.com {
        reverse_proxy 10.60.0.10:80 {
                header_up Host panel.zerolaghub.com
                header_up X-Real-IP {remote_host}
                header_up X-Forwarded-For {remote_host}
                header_up X-Forwarded-Proto {scheme}
        }
        log {
                output file /var/log/caddy/panel_access.log {
                        roll_size 100MiB
                        roll_keep_for 7d
                }
                level INFO
        }
}

# ♦ API - Node.js Backend (LEGACY - do not migrate, new is zpac-api)
api.zerolaghub.com {
        reverse_proxy 10.60.0.20:4000 {
                header_up Host {host}
                header_up X-Real-IP {remote_host}
                header_up X-Forwarded-For {remote_host}
                header_up X-Forwarded-Proto {scheme}
        }
        log {
                output file /var/log/caddy/api_access.log
                level INFO
        }
}

# ♦ PORTAL - Next.js Frontend (LEGACY - do not migrate, new is zpac-portal)
portal.zerolaghub.com {
        reverse_proxy 10.60.0.12:3000 {
                header_up Host {host}
                header_up X-Real-IP {remote_host}
                header_up X-Forwarded-For {remote_host}
                header_up X-Forwarded-Proto {scheme}
        }
        log {
                output file /var/log/caddy/portal_access.log
                level INFO
        }
}

# ♦ ROUTER - OPNsense Admin Portal
zlhrouter.zerolaghub.com, zlhrouter.zerolaghub.network {
        reverse_proxy 10.60.0.254:8443 {
                transport http {
                        tls
                        tls_insecure_skip_verify
                }
                header_up Host {host}
                header_up X-Real-IP {remote_host}
                header_up X-Forwarded-For {remote_host}
                header_up X-Forwarded-Proto {scheme}
        }
        log {
                output file /var/log/caddy/router_access.log
                level INFO
        }
}

# ♦ Wings - Wings server (LEGACY - do not migrate)
zlh-node1.zerolaghub.com {
        reverse_proxy 10.60.0.11:8080 {
                transport http {
                        tls
                        tls_insecure_skip_verify
                }
                header_up Host {host}
                header_up X-Real-IP {remote_host}
                header_up X-Forwarded-For {remote_host}
                header_up X-Forwarded-Proto {scheme}
        }
        log {
                output file /var/log/caddy/node1_access.log {
                        roll_size 50MiB
                        roll_keep_for 7d
                }
                level INFO
        }
}

# ♦ VPN - Headscale Server
zlhvpn.zerolaghub.com {
        reverse_proxy 10.60.0.251:8080
}

#-----------------------------------------ZPACKS----------------------------------------------------------#
# ♦ ZPACK test (commented out)
#mc304.zpack.zerolaghub.com {
#        reverse_proxy 10.99.200.11:25565
#}

#-----------------------------------------Suncrazycrafter----------------------------------------------------------#
portal.suncrazycrafter.biz {
        reverse_proxy 10.60.0.17:3000
}
