How do I setup a WebDAV Server on Windows and link it to odrive?
Update:
I’ve created a better structured and more thorough guide to setting up a WebDAV server on Windows and then syncing with it.
Note: Even if you aren’t interested in the syncing part (odrive), this guide will still quickly get you up and running with a functioning WebDAV server, using the first section
Original Post:
Here is how to setup a basic WebDAV server on Windows in about 5 minutes. Tested on Windows 10, Windows 8.1, and Windows 2012R2.
1) Open up a Powershell command prompt as administrator
2) Copy and paste the following command into Powershell and hit enter:
$feats = @("IIS-WebServerRole","IIS-WebServer","IIS-CommonHttpFeatures","IIS-HttpErrors","IIS-Security","IIS-RequestFiltering","IIS-WebServerManagementTools","IIS-DigestAuthentication","IIS-StaticContent","IIS-DefaultDocument","IIS-DirectoryBrowsing","IIS-WebDAV","IIS-BasicAuthentication","IIS-ManagementConsole");foreach ($feat in $feats) {Enable-WindowsOptionalFeature -Online -FeatureName $feat};New-SelfSignedCertificate -DnsName odrive-self-signed -CertStoreLocation cert:\LocalMachine\My;& "$env:windir\system32\inetsrv\InetMgr.exe";
This command will install the IIS modules needed for WebDAV, create a self-signed certificate to allow HTTPS, and launch the IIS Manager
3) Now that the IIS Manager is open, right-click on “Default Web Site” and select “Add Virtual Directory”
Select the location on your computer that you wish to make available via your WebDAV server (under “Physical path”), type “WebDAV” for the alias, and click “OK”.
4) Under “Default Website” select “Bindings”
Add a binding for https, port 4433, select “odrive-self-signed” as the SSL certificate, and click “OK”
Note: There is a bug in IIS that will reject to-spec MOVEs when the standard port is used, which is why I recommend a non-standard port like 4433. However, a workaround was done in the odrive move method to account for this, so it shouldn’t be a problem with odrive, but could be for other applications.
Remove the port 80 binding once you have port 4433 in.
5) Click on “SSL Settings” under “Default Web Site”
Select “Require SSL”, “Ignore” for “Client Certificates”, and click “Apply”
6) Click on “Authentication” under “Default Web Site”
Disable “Anonymous Authentication”, and enable “Basic Authentication”
7) Click on “WebDAV Authoring Rules” under “Default Web Site”
Click on “Enable WebDAV”
Click on “Add Authoring Rule”, select “All content” under “Allow access to”, select “All Users” under “Allow access to this content to”, check “Read” and “Write” under “Permissions”, and click “OK”.
8) Click on “Restart” under “Default Web Site”
9) The final step is to link your WebDAV server to odrive.
The example below is linking to a the server over the LAN because I have not setup external access to this machine. Setting up external access is outside the scope of this write-up, but let me know if you have questions about it.
Make sure port 4433 is specified in “Server” and “Require Valid SSL Certificate” is unchecked. The username and password will be the credentials you use to login to your Windows machine where the WebDAV server is running.
That should be it!
Keep in mind that this is a very basic setup. There are many areas you can dig into to add more users, control granular user access, add storage locations, use your own SSL certificate, integrate different authentication systems (like AD), etc…
Let me know if you encounter any issues with the above instructions. I am hoping it allows folks to install and use WebDAV fairly easily.
File Size Upload Limit:
IIS defaults to a 30MB file size limit for uploads. This can be changed to a maximum of 4GB:
Click on “Request Filtering” under “Default Web Site”
Click on “Edit Feature Settings”
Change the default value in “Maximum allowed content length (Bytes)” to 4294967295
and click “OK”
MIME Types
By default IIS will block serving content for MIME types that are unknown (flac and mkv, for example). You can add additional MIME Types (and remove others), if you wish to adjust what is supported. It is best practice to create an entry for each additional type you want to add. If you find yourself in a pinch, however, you can add a wildcard mapping until you can sort out the proper individual entries.
Click on “MIME Types” under “Default Web Site”
Click on “Add”
Add the new MIME Type extension and type and then click “OK”. In the example below we are adding the wildcard MIME mapping
If you plan to use IFS, odrive’s file splitting technology, you will want to add these two MIME Types:
Extension: “.meta”
MIME Type: “application/octet-stream”
Extension: “.”
MIME Type: “application/octet-stream”
Special Characters
The default settings should allow all characters that Windows allows, except the “+” character. There is a setting to try to deal with that.
Click on “Request Filtering” under “Default Web Site”, select “Edit Feature Settings”
Check “Allow double escaping”
any compatibility for a win 2008 r2 server?
Hi @nhutwelker,
I have not tested Windows Server 2008r2, but IIS for it (7.5) supports WebDAV. The instructions should be similar.
yup! just cant use the power shell you provided, you need to download MakeCert.exe via the Microsoft Windows SDK for Windows 7 and .NET Framework 4 which can be downloaded at https://www.microsoft.com/en-us/download/details.aspx?id=8279
Hello There,
I am trying to setting up WebDAV on IIS server i am getting a confusion in creating Virtual directory can someone please help me in this issue.
I am trying to setup WebDav to link to local drive. Managed it all the way to linking the WebDav server to odrive. I get the error messag: Cannot browse WebDAV. Please check your network connection or manage your proxy settings. I dont know what to enter as the server path. Where do I find that?
Hi @verheijp,
The path will be your server name/ip and port with the alias path you specified when setting up the WebDAV folder. (See step #3)
In the example above the alias was set as ‘WebDAV’, so the server url was my ip (10.10.10.2) with my port (4433) and my alias (WebDAV). When combined it is https://10.10.10.2:4433/WebDAV
.