Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nginx: Do not forward X-amz-cf-id header to S3.

Alex Vandivere8c854402879
diff --git a/puppet/zulip/files/nginx/zulip-include-frontend/uploads-internal.conf b/puppet/zulip/files/nginx/zulip-include-frontend/uploads-internal.conf
index 015ab09a83c..5e426b71591 100644
--- a/puppet/zulip/files/nginx/zulip-include-frontend/uploads-internal.conf
+++ b/puppet/zulip/files/nginx/zulip-include-frontend/uploads-internal.conf
@@ -12,8 +12,12 @@ location ~ ^/internal/s3/(?<s3_hostname>[^/]+)/(?<s3_path>.*) {
set $download_url https://$s3_hostname/$s3_path;
proxy_set_header Host $s3_hostname;
- # Ensure that we only get _one_ of these headers: the one that
- # Django added, not the one from S3.
+ # Strip off X-amz-cf-id header, which otherwise the request has to
+ # have been signed over, leading to signature mismatches.
+ proxy_set_header x-amz-cf-id "";
+
+ # Ensure that we only get _one_ of these response headers: the one
+ # that Django added, not the one from S3.
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_hide_header Set-Cookie;