Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdav with Jetbrains Rider, Caddy and ASP NET Core Umbraco CMS #36

Open
DanielOberlechner opened this issue Aug 12, 2023 · 7 comments
Open
Labels
question Further information is requested

Comments

@DanielOberlechner
Copy link

DanielOberlechner commented Aug 12, 2023

Hi,
I have these settings as default in webdav:

danobe.dev {
        # Set this path to your site's directory.
        #root * /usr/share/caddy

        # Enable the static file server.
        #file_server

        # Another common task is to set up a reverse proxy:
        reverse_proxy localhost:5000

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

I tried by know all different choices with webdav and tutorials in the internet, but I can't get it to work.
Bildschirmfoto 2023-08-12 um 12 06 40

This are the fields I have to enter in the image.
I'm not really familiar with webdav, it seems to be the only convinient way to deploy my application.

I have a linux server with the path /var/www/personalWebsite into which I would like to deploy my application.

It works via scp and rsync but it looks like I'm to dumb to get it to work with debdav.

Could you provide a clear explanation on how I have to change the caddy configuration file?

Like I've said I tried all possible combinations but I couldn't get it to work...

And how do I restrict the access, is this like a public ftp where everyone can deploy files?
I've read this here, and here it get's shown I have to create a password hash, but I don't know if this is necessary?
https://marko.euptera.com/posts/caddy-webdav.html

That would be very kind of you,
kind regards
greets from Italy,
Daniel

@mholt
Copy link
Owner

mholt commented Aug 17, 2023

Hi Daniel, I'm sorry to say I don't actually know much about this setup. What errors are you getting?

I've read this here, and here it get's shown I have to create a password hash, but I don't know if this is necessary?

It's recommended to use some form of authentication if you're enabling this on a public network interface, yes. basicauth is probably the easiest way to do it. This docs page can help: https://caddyserver.com/docs/caddyfile/directives/basicauth

@mholt mholt added the question Further information is requested label Aug 17, 2023
@DanielOberlechner
Copy link
Author

DanielOberlechner commented Aug 17, 2023

Hi @mholt,
thank you for answering!

I got the message:
"Unknown message with code webdav.danobe.dev:6180 failed to respond"

This is my Caddy config:

{
        order webdav before file_server
}


webdav.danobe.dev:6180 {
        root * /webdav
        basicauth {
                user $2a$14$9SMz8Yufvqjm03TuaBvesecPC9/pnE11hQh3YpLUkMG8XCP2Sr4GG
        }
        webdav
}

Ports are open and forwarded...

Any suggestions on how to fix or what I do wrong?

Kind regards,
Daniel Oberlechner

@wader
Copy link
Sponsor Collaborator

wader commented Aug 17, 2023

Hi, i would probably try without auth just to make sure then look into if prefix is needed. Looking at the above screenshot i suspect you might want prefix /dav? see the documentation about prefix for details

@DanielOberlechner
Copy link
Author

DanielOberlechner commented Aug 17, 2023


webdav.danobe.dev:6180 {
        #root /webdav
        basicauth {
                user $2a$14$9SMz8Yufvqjm03TuaBvesecPC9/pnE11hQh3YpLUkMG8XCP2Sr4GG
        }
        webdav {
                root /webdav
                #prefix /webdav
        }
        #webdav
        file_server
}

authentification works as expected.
Should this be the expected output, if you open it in chrome the site?

<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype>
<D:collection xmlns:D="DAV:"/>
</D:resourcetype>
<D:displayname/>
<D:getlastmodified>Thu, 17 Aug 2023 18:30:39 GMT</D:getlastmodified>
<D:supportedlock>
<D:lockentry xmlns:D="DAV:">
<D:lockscope>
<D:exclusive/>
</D:lockscope>
<D:locktype>
<D:write/>
</D:locktype>
</D:lockentry>
</D:supportedlock>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>

Because in chrome I get a response from the site ...
Not sure is this is what I would expect due to no experience regarding webdav ...

Kind regards

@wader
Copy link
Sponsor Collaborator

wader commented Aug 17, 2023

Yeap that looks like webdav-ish. I think you can do webdav request with curl by doing something like curl -H "Depth: 1" -X PROPFIND http://host/path. So if the webdav share is under some path like http://host/dav i think you need to use prefix /dav to get the webdav server know how to produce URL:s

Maybe it's worth trying with webdav client that is known to work first? think i've used macOS finder and kodi.

@DanielOberlechner
Copy link
Author

DanielOberlechner commented Aug 19, 2023

I found a workaround with finder:
https://webdav.danobe.dev:6180

with config:

{
        order webdav before file_server
}

webdav.danobe.dev:6180 {
        basicauth {
                user $2a$14$9SMz8Yufvqjm03TuaBvesecPC9/pnE11hQh3YpLUkMG8XCP2Sr4GG
        }
        webdav {
                root /webdav
        }
        file_server
}

will work in finder, but not in Rider.
The difference is Rider uses dav:// and in finder it doesn't work with dav:// prefix but with the https:// prefix...

Anyone an idea what I do wrong here? why does it work with https as prefix?
The problem in Rider is, I can't change the dav:// prefix to https:// because it inserts it automatically ...

Googleing the problem also had no answer for me.

Thank you @wader for your input with Finder, that was a good idea! :)

@mholt
Copy link
Owner

mholt commented Aug 19, 2023

@DanielOberlechner I'm guessing the dav prefix doesn't use TLS? Whereas HTTPS is just webdav HTTP requests over TLS? Quick googling suggests Rider may not support WebDAV over TLS (but it does support FTP over TLS)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants