summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2021-08-09 13:19:38 -0700
committerJesse Morgan <jesse@jesterpm.net>2021-08-09 13:19:38 -0700
commit692d346ab2924962abdb2c66cb255473aa27d4f3 (patch)
treeb34ed722232c799b45397d75164e9c182d31181c
parente07af7c02fc8a79fd3a7bf2cffc72bf3a57064eb (diff)
Add access-control-allow-origin header to media responses.
-rw-r--r--Dockerfile2
-rw-r--r--src/media.rs3
2 files changed, 4 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index c8e40d2..757fcf7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
# Based on https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/
-FROM rust:1.46.0 AS build
+FROM rust:1.54.0 AS build
MAINTAINER Jesse Morgan <jesse@jesterpm.net>
diff --git a/src/media.rs b/src/media.rs
index 0704f79..89d70e7 100644
--- a/src/media.rs
+++ b/src/media.rs
@@ -24,6 +24,9 @@ macro_rules! response_for {
31557600u32,
)]));
+ // Allow CORS
+ client_resp.set_header(header::ACCESS_CONTROL_ALLOW_ORIGIN, "*");
+
// Copy all of the relevant S3 headers.
$resp.cache_control.map(|v| client_resp.set_header(header::CACHE_CONTROL, v));
$resp.content_disposition.map(|v| client_resp.set_header(header::CONTENT_DISPOSITION, v));