Skip to content

Jailed dir behind nginx reverse proxy #3

@greenais

Description

@greenais

I'm stuck with jailed dir configuration, need your tip/advice if possible.

In config.yaml I have:

address: "192.168.1.2"        # the bind address
port: "2006"                 # the listening port
dir: "/DATA/DAV"             # the provided base dir
prefix: "/dav"               # the url-prefix of the original url
users:
  share:                     # with password '12321' and jailed access to '/DATA/DAV/share'
    password: "$2a$10$2FvylPKftS.IDhqR37NJHO4EuZjUmqG0Fmy4E3tFnPVprrJuUfMCK"
    subdir: "/share"
    permissions: "rc"        # read and create only
 admin:                       # with password '12321' and full access to '/DATA/DAV'
    password: "$2a$10$2FvylPKftS.IDhqR37NJHO4EuZjUmqG0Fmy4E3tFnPVprrJuUfMCK"
    permissions: "crud"

Corresponding nginx conf is:

location /dav {
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header REMOTE-HOST $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $host;
  proxy_pass_header Authorization;
  proxy_pass http://192.168.1.2:2006;
}

For admin user everything works like a charm (I can browse/download/upload files, but not rename - which is different story), while for share one I've got error in cadaver:

$ cadaver https://myhostname:1308/dav
Authentication required for  on server `myhostname':
Username: share
Password: 
Could not access /dav/ (not WebDAV-enabled?):
Did not find a collection resource.
Connection to `myhostname' closed.

which could be explained by david logs:

INFO[0000] Server is starting and listening              address=192.168.1.2 port=2006 security=none
DEBU[0014] User was authenticated                        crud="&{rc true true false false}" user=share
DEBU[0014] Method received                               method=OPTIONS
DEBU[0014] User was authenticated                        crud="&{rc true true false false}" user=share
DEBU[0014] Method received                               crud=rc method=PROPFIND user=share
DEBU[0014] Header received                               Path=/DATA/DAV/share/dav user=share

Please note this trailing /dav in path after /share - where it comes from?
And how to get rid of it - as it obviously breaks the whole thing?

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions