1
0
Fork 0
mirror of https://github.com/win-acme/win-acme.git synced 2026-04-27 03:55:56 +03:00
2 web_config.xml
Wouter Tinus edited this page 2018-02-22 21:09:18 +01:00

Overview

When using FileSystem validation (which you shouldn't), web_config.xml is used as a template to create a web.config file in the folder that serves ACME challenge file. Since the challenge file doesn't have an extension, IIS won't serve it up by default. There are many different ways to code your web.config file so that it works with your site.

Notes:

This was released in version 1.8

Included File

The file included with the application, in the application root is the web_config.xml. That file has been tested with stock IIS on Server 2012, Server 2012 R2, Server 2016, Win 7, and Win 8.1. It will not work with MVC sites out of the box. Supporting MVC sites then means that it won't work with some other sites. Since there may have to be varying ways to have the file setup so it works with everything, the application simply copies the web_config.xml file to be the web.config file when the certificate is being requested.

Changing the Included file

To make a change to the web.config file, simply open the web_config.xml file in a text editor and change the sections to work for you.

MVC Changes

The following should work for MVC sites and ASP.NET Core 1.0 sites.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <clear/>
            <mimeMap fileExtension = ".*" mimeType="text/json" />
        </staticContent>
        <handlers>
            <clear />
            <add name="StaticFile" path="*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
        </handlers>
    </system.webServer>
</configuration>

Sources: https://github.com/PKISharp/win-acme/issues/37, https://github.com/PKISharp/win-acme/issues/114

URL rewrite support

To add support within sites that use URL Rewrite rules (for example Joomla or Wordpress), add the following rule into your web.config in the site root under configuration\system.webServer\rewrite\rules. This rule should be the first one right after the <clear /> (if there is one).

<rule name="LetsEncrypt Rule" stopProcessing="true">
    <match url="^\.well-known.*$" />
    <action type="None" />
</rule>

Source: https://github.com/PKISharp/win-acme/issues/103