From 1853566b1ab7fe72dc8a3d23e1195a1c93cbf596 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 12 Apr 2019 17:17:54 +0200 Subject: [PATCH] serve datastore over the webserver in the example nginx config --- docs/example.nginx.conf | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index 9d856a5a9..34d114402 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -67,6 +67,25 @@ server { proxy_set_header Connection upgrade; } + location ^~ /datastore/ { + alias /home/cryptpad/office.cryptpad/data/datastore; + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Max-Age' 0; + add_header 'Content-Type' 'application/octet-stream; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + add_header Cache-Control max-age=0; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + try_files $uri =404; + } + location ^~ /customize.dist/ { # This is needed in order to prevent infinite recursion between /customize/ and the root }