Skip to content

Commit 0c5a28a

Browse files
committed
allow options to cors server
1 parent 93f24be commit 0c5a28a

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

rootfs/etc/nginx/sites-enabled/pychat.conf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,35 @@ server {
2020
gzip_comp_level 6;
2121
gzip_buffers 16 8k;
2222
gzip_http_version 1.1;
23+
2324
location /photo {
24-
alias /srv/http/pychat/backend/photos;
25-
add_header Access-Control-Allow-Origin https://pychat.org;
25+
alias /srv/http/pychat/backend/photos;
26+
add_header Access-Control-Allow-Origin https://pychat.org;
27+
add_header Access-Control-Allow-Headers Range;
28+
if ($request_method = 'OPTIONS') {
29+
return 204;
30+
}
2631
}
2732

2833
location ~ "^/photo/(?<filepath>\w{8}_(?<filename>.*))$" {
2934
add_header Content-Disposition 'inline; filename="$filename"';
3035
alias /srv/http/pychat/backend/photos/$filepath;
3136
add_header Access-Control-Allow-Origin https://pychat.org;
37+
add_header Access-Control-Allow-Headers Range;
38+
if ($request_method = 'OPTIONS') {
39+
return 204;
40+
}
3241
}
3342

3443
root /srv/http/pychat/frontend/dist/;
3544

3645
location / {
3746
try_files $uri /index.html;
3847
add_header Access-Control-Allow-Origin https://pychat.org;
48+
add_header Access-Control-Allow-Headers Range;
49+
if ($request_method = 'OPTIONS') {
50+
return 204;
51+
}
3952
}
4053

4154
ssl_certificate /etc/letsencrypt/live/static.pychat.org/fullchain.pem; # managed by Certbot

0 commit comments

Comments
 (0)