]> git.proxmox.com Git - proxmox.git/commitdiff
notify: fix #5274: also set 'X-Gotify-Key' header for authentication
authorLukas Wagner <l.wagner@proxmox.com>
Wed, 3 Apr 2024 08:08:25 +0000 (10:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 4 Apr 2024 14:51:55 +0000 (16:51 +0200)
Versions of Gotify < 2.2.0 only supported the 'X-Gotify-Key' header
for passing the API token. This comment sets this header in addition
to the regular 'Authorization' header in order to be compatible with
older Gotify servers.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
proxmox-notify/src/endpoints/gotify.rs

index 90ae959d5dfd3e499897551942dc9636071dc682..20c83bf51ac611af23d0154d87d2b806570a0004 100644 (file)
@@ -124,10 +124,13 @@ impl Endpoint for GotifyEndpoint {
 
         let body = serde_json::to_vec(&body)
             .map_err(|err| Error::NotifyFailed(self.name().to_string(), err.into()))?;
-        let extra_headers = HashMap::from([(
-            "Authorization".into(),
-            format!("Bearer {}", self.private_config.token),
-        )]);
+        let extra_headers = HashMap::from([
+            (
+                "Authorization".into(),
+                format!("Bearer {}", self.private_config.token),
+            ),
+            ("X-Gotify-Key".into(), self.private_config.token.clone()),
+        ]);
 
         let proxy_config = context()
             .http_proxy_config()