How to serve uncommon file in WebDAV using IIS in Win Server

HiroshiFuu發表於2018-01-04

Introduction

We are using a cross-platform web password manager, and this manager is deployed in our own on promised cloud. Although it supports Dropbox, Google Drive, One Drive, our network does not allow them. So, the issue comes, the data file need be stored somewhere in the network. Then the only choice left is WebDAV.

Some Issues

This password manager requires SSL.
Web serving involves HTTP response configuration.
The data file is not common type.

Procedure

Turn on IIS

Add Web Server (IIS) server role and install the following additional feature
WebDAV Publishing
Centrailized SSL Certificate Support

Configure IIS

Generate Self-Signed Certificate

  1. Goto IIS Manager
  2. Open Server Certificates
  3. Click Create Self-Signed Certificate
  4. Select Web Hosting for the certificate store

Enable SSL

  1. Goto the site
  2. Click Bindings
  3. Add a new site binding with type https, select the SSL certificate just created.

WebDAV Authorization

  1. Goto the site
  2. Open WebDAV Authoring Rules
  3. Add new rule as you prefer

Serve Uncommon File

  1. Goto the site
  2. Open MIME Types
  3. Add new entry with the file extension and tyope application/octet-stream

Optional HTTP Response Headers Configuration

Add Access-Control-Allow-Origin with value * to solve `No Access-Control-Allow-Origin header is present Or Working With Cross Origin Request`.
Add Access-Control-Allow-Headers with value Content-Type to solve `Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers in preflight response`.
For me, I need to add another value Cache-Control for Access-Control-Allow-Headers as required by the password manager.

相關文章