Open madcoda9000 opened 1 week ago
Hey, thanks for the feedback! A couple questions:
WEBDAV_USER2=user2
and WEBDAV_PASS2=password2
). I guess what I'm saying is, I can't arbitrarily add infinite users. What are your thoughts on three users?cadaver
to put things into the webdav location. In my case, this container is running behind a Traefik reverse proxy, so maybe I'm not hitting a CORS issue? Looking at a couple examples here and here, what do you suggest for some values like Access-Control-Allow-Origin
and Access-Control-Max-Age
? I obviously can't hard-code the Access-Control-Allow-Origin
hostname, so maybe a *
in that case?Hello,
thank you for getting back on this.
And yes, ccess-Control-Allow-Origin * would do the trick.
I just pushed 1.0.1 with the ability to add multiple users (I suppose infinite users) by passing this variable
WEBDAV_USERS=user1:password1,user2:password2
It's a breaking change, so you'll need to update the variable to use the new syntax.
Still working out how I want to implement the CORS stuff...
Ahhh, that is awesome!
Regarding your question about CORS.
simply modify your webdav.conf from this:
server {
listen 80 default_server;
server_name _;
root /var/www/webdav;
autoindex on;
client_max_body_size 250M;
charset UTF-8;
location /public {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw;
create_full_put_path on;
error_log /dev/stdout;
access_log /dev/stdout;
}
location /restricted {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/webdav_credentials;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw;
create_full_put_path on;
error_log /dev/stdout;
access_log /dev/stdout;
}
}
to this:
server {
listen 80 default_server;
server_name _;
root /var/www/webdav;
autoindex on;
client_max_body_size 250M;
charset UTF-8;
location /public {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw;
create_full_put_path on;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination,overwrite' always;
add_header 'Access-Control-Expose-Headers' 'ETag' always;
add_header 'Access-Control-Max-Age' 1728000 always;
error_log /dev/stdout;
access_log /dev/stdout;
}
location /restricted {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/webdav_credentials;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw;
create_full_put_path on;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Accept-Charset,X-Accept,origin,accept,if-match,destination,overwrite' always;
add_header 'Access-Control-Expose-Headers' 'ETag' always;
add_header 'Access-Control-Max-Age' 1728000 always;
error_log /dev/stdout;
access_log /dev/stdout;
}
}
I considered that, but opening CORS up to * is a security risk. I'm wondering if there is a way that the user can pass an env var in, which gets injected into the Access-Control-Allow-Origin
header...
Hello,
at first i want to thank you for that image. This is by far the best webdav image I've seen for a wile!
I just want to suggest two improvements for further versions, maybe...
Best Regards Sascha