feat(proxy): validate stored config matches current proxy type

Add validation in GetProxyConfiguration to detect when stored proxy config
belongs to a different proxy type (e.g., Traefik config on a Caddy server)
and trigger regeneration with a warning log. Clear cached proxy configuration
and settings when proxy type is changed to prevent stale configs from being
reused. Includes tests verifying config rejection on type mismatch and
graceful fallback on invalid YAML.
This commit is contained in:
Andras Bacsai committed 2026-03-24 21:32:34 +01:00
1 parent eebb8609a7
commit b8e52c6a45
3 files changed
+106 -3

No files matched your search

+3
View File
@@ -1471,6 +1471,9 @@ $schema://$host {
if ($validProxyTypes->contains(str($proxyType)->lower())) {
$this->proxy->set('type', str($proxyType)->upper());
$this->proxy->set('status', 'exited');
$this->proxy->set('last_saved_proxy_configuration', null);
$this->proxy->set('last_saved_settings', null);
$this->proxy->set('last_applied_settings', null);
$this->save();
if ($this->proxySet()) {
if ($async) {