What's New In 2.1.0 - URL Rewrite Administration

Via Microsoft IIS Administration API 2.1.0

If you are unfamiliar with the API, check out our earlier post for an introduction.

The IIS team has been working on making the IIS Administration API a complete solution for managing all aspects of the web server. The newest addition to the API is an endpoint for the URL Rewrite module. This module is one of the most popular due to its ability to provide complete control over HTTP requests and responses at the webserver level. With the new API endpoint , obtaining, configuring, and using the URL Rewrite module is easier than ever. 

Install And Uninstall Via the API

Unlike most IIS modules, URL Rewrite does not come by default with Windows. This meant that to start using the module one needed to download it and then install it on the web server. With the new URL Rewrite endpoint, the module can be installed with a single request just like any other IIS feature. The API will obtain the latest version of URL Rewrite, install it on the web server, and then report the success of the installation. Uninstalling URL Rewrite is also supported, so performing an upgrade from an older version is possible by uninstalling and then reinstalling via this new endpoint.

Complete Coverage

URL Rewrite is capable of satisfying many scenarios in a simple manner, but it is also possible to use URL Rewrite for advanced scenarios such as implementing CORS. To handle all this functionality URL Rewrite comes with a lot of switches and knobs. This new endpoint exposes all of the configuration for URL Rewrite through JSON resources. 

One common scenario encountered in web development is the desire to redirect all HTTP traffic to HTTPS for a given website. Below is a URL Rewrite rule that can be used for this purpose as seen through the IIS Administration API.

{
    "name": "Redirect to HTTPS",
    "id": "{id}",
    "priority": "0",
    "pattern": "(.*)",
    "pattern_syntax": "regular_expression",
    "ignore_case": "true",
    "negate": "false",
    "stop_processing": "true",
    "response_cache_directive": "auto",
    "condition_match_constraints": "match_any",
    "track_all_captures": "false",
    "action": {
        "type": "redirect",
        "url": "https://{HTTP_HOST}/{R:1}",
        "append_query_string": "true",
        "log_rewritten_url": "false",
        "redirect_type": "found"
    },
    "server_variables": [],
    "conditions": [
        {
            "input": "{HTTPS}",
            "pattern": "off",
            "negate": "false",
            "ignore_case": "true",
            "match_type": "pattern"
        }
    ],
    "url_rewrite": {
        "id": "{rewrite-id}",
        "scope": "Default Web Site/",
        "_links": {
            "self": {
                "href": "/api/webserver/url-rewrite/{rewrite-id}"
            }
        }
    }
}

URL Rewrite Web UI

To compliment the new endpoint, a URL Rewrite section has been added to https://manage.iis.net. This UI enables users to install and customize URL Rewrite for the web server. There are multiple features to aid in customizing URL Rewrite rules including regex testing, auto fill suggestions for IIS server variables, and rule cloning.

For the initial release of the URL Rewrite UI on https://manage.iis.net there will not be support for preconditions and custom tag sets on outbound rewrite rules. These features will be added into the UI at a later date, however they are already present in Microsoft IIS Administration API 2.1.0.

Feedback

The IIS team would love to hear what users think of the experience we're building at https://manage.iis.net, so we've added a feedback button. The new button can be found at the top right of the web manager and in the settings menu on mobile devices. 

5 Comments

  • I am finding how to rewrite my URL because I was afraid of ranking. Thank for your sharing. It helps me much. Wish you will make more

  • This is some great work for managing IIS! Our IIS severs are behind a corporate firewall/intranet and I would like to see its possible to run the Microsoft IIS Administration UI website on a local server without using the https://manage.iis.net site as it is not able to see my IIS servers when I try to connect. Is there already an on-prem version?

  • @j,

    Note that https://manage.iis.net/ doesn't proxy any requests to your IIS Servers. It's pure client side JScript implementation. The connection from your browser to your IIS deployment is direct, without going through the UI server at all. As long as your machine can establish direct connection to your IIS servers (by IP, domain name, etc.) and has internet connection (to obtain the jscripts from https://manage.iis.net/) you should be able to connect and remotely manage IIS behind firewall just fine. Make sure that IIS Administration API port (default 5553) is accessible to the machines you are planning to manage IIS depoyments from.

    Saying that, the project that powers https://manage.iis.net/ is open source, available at https://github.com/Microsoft/IIS.WebManager. Feel free to run it on-prem.

  • I am having problem of login

  • @Patrick,

    I'd be happy to help if you provide a little more information on what the problem that your experiencing is.

Add a Comment

As it will appear on the website

Not displayed

Your website