fix(webhook): User-Agent 'ordinis-alerts' (matches Webhook Bot subscription)

This commit is contained in:
Александр Зимин
2026-05-15 15:24:12 +00:00
parent 51b45836de
commit 0269542ebe
@@ -226,7 +226,16 @@ public class WebhookDispatcher {
.uri(URI.create(sub.getUrl())) .uri(URI.create(sub.getUrl()))
.timeout(Duration.ofMillis(sendTimeoutMs)) .timeout(Duration.ofMillis(sendTimeoutMs))
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.header("User-Agent", "Ordinis-Webhook/1.0") // Webhook Bot identifies sender by User-Agent (see incoming subscription
// allowlist). Value 'ordinis-alerts' matches subscription name на стороне
// chat.nstart.cloud — пишется literally without version suffix.
//
// NB: для override этого header'а нужен JVM flag
// `-Djdk.httpclient.allowRestrictedHeaders=user-agent` (см. ordinis-infra
// values.yaml / writer.yaml args). Без flag Java HttpClient silently drops
// user-set User-Agent → receiver видит Java-http-client/<jvm-version>
// → Webhook Bot не находит subscription → 'неизвестный webhook'.
.header("User-Agent", "ordinis-alerts")
.header(HmacSigner.HEADER_NAME, signature) .header(HmacSigner.HEADER_NAME, signature)
.header("X-Ordinis-Event-Id", String.valueOf(event.getId())) .header("X-Ordinis-Event-Id", String.valueOf(event.getId()))
.header("X-Ordinis-Event-Type", event.getEventType()) .header("X-Ordinis-Event-Type", event.getEventType())