Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Docs
  2. Domains & SSL
  3. Redirects & proxies

Redirects & proxies

Nginx redirects and prefix reverse proxies per app.

Domains & SSL

Move pages or whole sites without losing visitors or search ranking, and route a path to another service. Rules live in Cipi's state and survive every vhost change.

Redirect a whole app#

Every name the app answers to (primary, aliases, www) goes to the target in one hop.

bash
cipi redirect set oldsite --to=https://new.com            # 301, path and query kept
cipi redirect set oldsite --to=https://new.com --302 --no-path
cipi redirect disable oldsite      # serve the app again, keep the target
cipi redirect enable oldsite
cipi redirect unset oldsite

Status codes: --301 (default), --302, --307, --308. The old name's certificate keeps renewing, so HTTPS visitors get a valid redirect too.

Redirect paths#

bash
cipi redirect add myapp /old-pricing /pricing
cipi redirect add myapp /blog/ https://blog.example.com/
cipi redirect add myapp /docs/ https://docs.example.com --308 --no-path
cipi redirect list myapp
cipi redirect remove myapp /old-pricing
fromMatchesExample
/old (no trailing slash)Exactly that path; query kept/old?x=1 → /new?x=1
/blog/ (trailing slash)The prefix; the rest is appended/blog/x?y → https://blog.example.com/x?y
with --no-pathEverything to the target as is/blog/x → https://blog.example.com/

Path redirects and proxies keep working while an app redirect is on, so a moved site can keep /api/ in place.

Proxy a path to another service#

Hand /api/, /events/ or /docs/ to a Node or Go service, a legacy app or another origin.

bash
cipi proxy add myapp /api/ http://127.0.0.1:3000 --strip-prefix
cipi proxy add myapp /events/ http://127.0.0.1:4000 --no-buffering --timeout=3600
cipi proxy add myapp /docs/ https://docs-origin.example.com --preserve-host
cipi proxy list myapp
cipi proxy remove myapp /api/
OptionEffect
(none)URI unchanged: /api/users → upstream/api/users
--strip-prefix/api/users → upstream/users, with X-Forwarded-Prefix
--preserve-hostSend the visitor's Host
--timeout=NUpstream timeout in seconds
--no-bufferingFor Server-Sent Events, long polling, streaming

Every proxy carries WebSocket upgrade and X-Real-IP / X-Forwarded-* headers; basic auth, when on, covers it too.

Safety rails#

GuardProtects against
Strict charset for paths and URLsInjecting Nginx directives
Reserved paths (/, ACME, /robots.txt, /cipi/webhook, Reverb's /app)Breaking certificates, webhooks or WebSockets
Loop and overlap detectionRedirect loops; a redirect and a proxy on the same prefix
Loopback guardProxying to Cipi's own ports (SSH, databases, Valkey, Octane, Reverb) without --force; the panel and cipi.yml can never force
nginx -t before reloadA bad rule: config and state are restored, exit code 1

Changes fire redirect_change / proxy_change notifications. Also available in the panel, the API and cipi.yml.