update_site
Redirect an existing site to a new backend by rewriting its proxy_pass directive, preserving SSL and other settings. Automatically tests config and rolls back on failure.
Instructions
Update an existing site's upstream by rewriting its proxy_pass directive(s) in place - everything else in the config, including any SSL server block issue_cert/certbot added, is left untouched. Fails if the domain has no existing config (use create_site instead) or has no proxy_pass directive to update. Test-renders before keeping the change and rolls back automatically if nginx -t fails. The previous config is backed up first, so a bad-but-valid change can be undone later with rollback_site. Does NOT reload nginx - call reload_nginx afterward.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain of the existing site to update | |
| upstream_host | Yes | New hostname or IP nginx should proxy_pass to | |
| upstream_port | Yes | New TCP port on the upstream host |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | Yes | ||
| test_output | Yes | Output of `nginx -t` against the rewritten config, or an explanatory message if nothing was changed | |
| backup_created | No | True once the previous config was backed up; undo with rollback_site | |
| reload_required | Yes | True on success - nginx has not actually been reloaded yet |