Smart-Caddy
GitHub
One file · one command · Caddy does the rest

Give it a domain. It builds the reverse proxy.

A single bash script that manages Caddy for you: automatic TLS, a web panel, and it refuses to leave your server broken. It validates every change before applying it and rolls back if anything is wrong.

Install — always fetches the latest release
curl -fsSL https://github.com/Plus98ir/Smart-Caddy/releases/latest/download/smart_caddy.sh -o smart_caddy.sh && sudo bash smart_caddy.sh
Installs Caddy if it isn't there, then asks its way through the rest. Nothing is assumed about your server.

What it actually does

Every item below is a thing the script does on its own — not a thing you configure.

A backend is not only a port

The second argument to add can be any of these. The script works out which one it is.

Xray already owns :443? Fine.

On most servers port 443 is taken by Xray or x-ui, so a normal Caddy install simply refuses to start. With --behind-xray, Caddy listens on a free loopback port as plain HTTP with PROXY protocol and h2c, and the script prints the exact fallback row to paste into x-ui.

Xray terminates TLS and routes by SNI, so your real visitor IP survives via PROXY protocol. The script reads Xray's own config to verify the fallback actually exists before telling you it works.

A web panel, if you want one

One command puts a real admin page on a domain of your choosing. It is a small Python service using only the standard library — no Node, no pip, nothing to keep updated.

    smart-caddy panel caddy.example.com
    smart-caddy panel caddy.example.com --behind-xray
    smart-caddy passwd
    smart-caddy panel status

    The password is changed from the terminal, never from the web page — so losing access to the page never locks you out of the server.

    Why it won't break your server

    These are the guarantees, in the order they matter.

    Commands

    The full set. Run smart-caddy with no arguments for the same list plus every option.

    commandwhat it does

    Questions

    The ones that come up first.

    One command and you're done

    Works on a single-IP VPS or a multi-IP server. Nothing is tailored to any particular setup.

    Open on GitHub