aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/nginx
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-24 16:44:46 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 18:03:39 +0200
commit7f8db30ccd2162a30f71a8a691c15af6320469d2 (patch)
tree934d9ade4590a9daaed52c9b1fdc0f7cf45b8a95 /support/nginx
parent1194e8b46f53204967271f1c6bfb7428a717a483 (diff)
downloadPeerTube-7f8db30ccd2162a30f71a8a691c15af6320469d2.tar.gz
PeerTube-7f8db30ccd2162a30f71a8a691c15af6320469d2.tar.zst
PeerTube-7f8db30ccd2162a30f71a8a691c15af6320469d2.zip
Add cors to static route in nginx template
Diffstat (limited to 'support/nginx')
-rw-r--r--support/nginx/peertube16
1 files changed, 16 insertions, 0 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube
index e4f625ce4..201d95ea2 100644
--- a/support/nginx/peertube
+++ b/support/nginx/peertube
@@ -54,6 +54,22 @@ server {
54 } 54 }
55 55
56 location ~ ^/static/(thumbnails|avatars)/(.*)$ { 56 location ~ ^/static/(thumbnails|avatars)/(.*)$ {
57 if ($request_method = 'OPTIONS') {
58 add_header 'Access-Control-Allow-Origin' '*';
59 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
60 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
61 add_header 'Access-Control-Max-Age' 1728000;
62 add_header 'Content-Type' 'text/plain charset=UTF-8';
63 add_header 'Content-Length' 0;
64 return 204;
65 }
66
67 if ($request_method = 'GET') {
68 add_header 'Access-Control-Allow-Origin' '*';
69 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
70 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
71 }
72
57 # Cache 2 hours 73 # Cache 2 hours
58 add_header Cache-Control "public, max-age=7200"; 74 add_header Cache-Control "public, max-age=7200";
59 75