chiark / gitweb /
actix: Fix CORS
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Apr 2022 21:57:21 +0000 (22:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Apr 2022 21:57:21 +0000 (22:57 +0100)
The docs aren't entirely clear but suggest that the default allowed
origins is All.  But dbg! output seems to contradict this.  And we
should support more headers, and say that we don't vary our CORS at
all.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/main.rs

index 6e2a957353458820854b5005cd9aaf870537a3cf..d6d624675b4df28e54eab83d49e4ca51ad3952c1 100644 (file)
@@ -280,9 +280,10 @@ impl<'r> FromFormValue<'r> for BundleToken {
 */
 
 fn updates_cors() -> Cors {
-
   Cors::default()
-      .allowed_methods([Method::GET])
+    .allow_any_origin()
+    .allowed_methods([Method::GET, Method::OPTIONS, Method::HEAD])
+    .disable_vary_header()
 }
 
 #[derive(Debug, Deserialize)]