-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
57 lines (43 loc) · 1.79 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name webdav.club1.fr;
ssl_certificate /etc/letsencrypt/live/club1.fr/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/club1.fr/privkey.pem;
client_max_body_size 1G;
# Client autodiscover using .well-known
rewrite ^/.well-known/caldav$ / redirect;
rewrite ^/.well-known/carddav$ / redirect;
# Fake NextCloud for Gnome-online-accounts
rewrite ^/remote.php/carddav / redirect;
rewrite ^/remote.php/caldav / redirect;
rewrite ^/remote.php/webdav / redirect;
#rewrite ^/remote.php/carddav/?(.*)$ /$1 redirect;
#rewrite ^/remote.php/caldav/?(.*)$ /$1 redirect;
#rewrite ^/remote.php/webdav/?(.*)$ /$1 redirect;
include proxy_params;
location /files {
# This header must be present in all responses
add_header access-control-allow-origin * always;
# OPTIONS requests are preflight for cross-origin requests in web browsers (drive.club1.fr)
if ($request_method = OPTIONS) {
# CORS headers for JS frontend
add_header access-control-allow-origin *;
add_header access-control-allow-methods GET,POST,PUT,PATCH,DELETE,OPTIONS,PROPFIND,PROPPATCH,MOVE,COPY,MKCOL,LOCK,UNLOCK;
add_header access-control-allow-credentials true;
add_header access-control-allow-headers authorization,dnt,user-agent,keep-alive,content-type,accept,origin,depth,destination;
# Tell client that this preflight info is valid for 100h
add_header access-control-max-age 360000;
# DAV header
add_header dav 1,2,3,extended-mkcol,sabredav-partialupdate;
# Allways return OK as browsers do not use auth credentials on preflight
return 204;
}
proxy_pass http://127.0.0.1:8080;
}
location / {
proxy_pass http://127.0.0.1:8080;
}
access_log /var/log/nginx/webdav_access.log;
error_log /var/log/nginx/webdav_error.log;
}