-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnginx.conf
More file actions
43 lines (34 loc) · 1.17 KB
/
nginx.conf
File metadata and controls
43 lines (34 loc) · 1.17 KB
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
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# 允许更大的备份上传体积,避免 WebDAV 上传时 413
client_max_body_size 50m;
# proxy_pass 使用变量时需要显式 DNS 解析器
resolver 1.1.1.1 8.8.8.8 valid=300s ipv6=off;
# WebDAV 同源代理入口:前端请求 /api/webdav/<remote-path>
# 并通过 X-WebDAV-Endpoint 传入真实 WebDAV 地址(含基础路径)。
location ~ ^/api/webdav/(.+)$ {
if ($http_x_webdav_endpoint = "") {
return 400 "missing X-WebDAV-Endpoint";
}
# 透传 WebDAV 关键请求头
proxy_set_header Authorization $http_authorization;
proxy_set_header Depth $http_depth;
proxy_set_header Destination $http_destination;
proxy_set_header Overwrite $http_overwrite;
# 关键:HTTPS 上游(Cloudflare / WebDAV)通常需要 SNI 与正确 Host
proxy_ssl_server_name on;
proxy_ssl_name $proxy_host;
proxy_set_header Host $proxy_host;
proxy_pass $http_x_webdav_endpoint/$1$is_args$args;
}
location / {
try_files $uri /index.html;
}
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
}