I have the following setup:
location @public {
auth_basic off;
}
location @webdav {
proxy_set_header Host $host;
proxy_pass http://localhost:8080;
}
location / {
# WebDAV server
if ($request_method != GET) {
error_page 418 = @webdav;
return 418;
}
gzip on;
fancyindex on;
location ~ /(public|\.well-known)/ {
if ($remote_user = "") {
error_page 418 = @public;
return 418;
}
}
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nDisallow: /\n";
}
}
I want to redirect every non-GET request to my internal WebDAV handler written in Go. the /public
folder should be accessible without basic auth, unlike the rest of the filesystem.
However, for nested location blocks, my parent if statement seems to be ignored. Attempting any non-GET request on /public
results in 505
, and on /robots.txt
returns my configured text. However, this is not the case with gzip
or fancyindex
, as both /public
and robots.txt
are gzipped and fancy indexed.
Aucun commentaire:
Enregistrer un commentaire