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:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SlpModularCms.Core.Availability;
|
||||
using SlpModularCms.Core.Observability;
|
||||
using SlpModularCms.Modules.Availability.Models;
|
||||
using SlpModularCms.Modules.Availability.Services;
|
||||
@@ -25,7 +26,14 @@ public class MasterController : ControllerBase
|
||||
var apiKey = Request.Headers["X-Master-Api-Key"].FirstOrDefault();
|
||||
if (string.IsNullOrEmpty(apiKey)) return RejectKey();
|
||||
|
||||
var success = await _svc.RegisterAsync(request.MasterUrl, apiKey);
|
||||
// The address is stored and polled later: refuse one that cannot be used, and say so without echoing it.
|
||||
if (!MasterUrlRules.IsValid(request.MasterUrl))
|
||||
{
|
||||
_logger.LogWarning("Master registration refused: the master URL is not an absolute http(s) address (invalid_master_url).");
|
||||
return BadRequest(new { code = "invalid_master_url", detail = "The master URL must be an absolute http(s) address, for example https://master.example.com." });
|
||||
}
|
||||
|
||||
var success = await _svc.RegisterAsync(request.MasterUrl.Trim(), apiKey);
|
||||
return success ? Ok() : RejectKey();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user