Master-URL: ongeldige of placeholder-waarde wordt nooit opgeslagen of verstuurd (master slaat achtergrondchecks over, slave weigert met 400, poller meldt invalid_master_url); veilige diagnostiek bij een mislukte poll; releasenote Master__MasterUrl

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 21:08:47 +01:00
co-authored by Claude Sonnet 5.5
parent 64a467b41b
commit 195443d9a9
11 changed files with 230 additions and 4 deletions
@@ -0,0 +1,21 @@
namespace SlpModularCms.Core.Availability;
/// <summary>
/// What counts as a usable master address. A slave stores whatever the master registers and later builds
/// "{url}/api/v1/SlaveStatus" from it, so an unusable value (the "&lt;public-url-...&gt;" placeholder of the shipped
/// appsettings, an empty string, a host without scheme) breaks every poll with an exception instead of a message.
/// </summary>
public static class MasterUrlRules
{
/// <summary>An absolute http or https URL with a host, without credentials, query or fragment.</summary>
public static bool IsValid(string? value)
{
if (string.IsNullOrWhiteSpace(value)) return false;
if (!Uri.TryCreate(value.Trim(), UriKind.Absolute, out var uri)) return false;
return (uri.Scheme == Uri.UriSchemeHttps || uri.Scheme == Uri.UriSchemeHttp)
&& !string.IsNullOrEmpty(uri.Host)
&& string.IsNullOrEmpty(uri.UserInfo)
&& string.IsNullOrEmpty(uri.Query)
&& string.IsNullOrEmpty(uri.Fragment);
}
}