Compartilhar via


Deploy Application Request Routing in CDN

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

This topic describes how to configure a child (edge) cache node and a parent cache node in a two-tier cache hierarchy. You will use advanced URL rewrite rules for this configuration in a content delivery network (CDN) or edge caching network (ECN). In a two-tier cache hierarchy with child and parent cache nodes, the origin lookup is done by the child cache node and the parent cache node acts as a forward proxy. A System Area Network (SAN) is configured to be shared by the child cache node. For more information about the disk-based cache feature in Application Request Routing (ARR) and cache hierarchy management, see Configure and Enable Disk Cache in ARR and Manage Cache Hierarchy Using ARR.

You must have the following resources and configuration before you can continue:

  • The disk cache feature configured and enabled.

    To configure and enable the disk-based cache feature and/or configure SAN to be used as a secondary cache drive location, see Configure and Enable Disk Cache in ARR.

  • A server farm with parent cache nodes defined.

    To define a server farm and add parent cache nodes, see Manage Cache Hierarchy Using ARR.

Configure Child (Edge) Cache Node

When you define a server farm, URL rewrite rules are automatically created to route incoming requests. In a CDN/ECN deployment, these rules cannot work as written because the cache nodes are tiered. If there is a cache miss at the child cache nodes, the parent cache nodes are unable to find the origin servers. To prevent this outcome, you can map the origin servers on the child cache nodes before requests are routed to the parent cache nodes. If you have the origin server map, when there is a cache miss and the request is routed to the parent cache node, the request will have the host name that matches the origin server.

To map the origin server on the child cache node

  1. Open IIS Manager.

  2. In the Connections pane, select the server node. This is your child cache node.

  3. In the server pane, double-click URL Rewrite.

  4. On the URL Rewrite page, in the Actions pane, click View Rewrite Maps….

  5. On the URL Rewrite Maps page, in the Actions pane, click Add Rewrite Map….

  6. In the Add Rewrite Map dialog box, enter a name for your rewrite map. For example, OriginServers. Click OK.

  7. On the Edit Rewrite Map page, in the Actions pane, click Add Mapping Entry….

  8. In the Add Mapping Entry dialog box, do the following:

    1. In the Original value box, enter the origin server name.

    2. In the New value box, enter the host name that the child cache node receives.

    3. Click OK.

  9. Repeat step 8 as needed to create an explicit list of your customers.

  10. On the Edit Rewrite Map page, in the Actions pane, click Edit Map Settings….

  11. In the Edit Rewrite Map dialog box, in the Default value to use when the key is not found in the map, enter #, and then click OK. This will prevent customers that are not on the rewrite map list from receiving service.

  12. On the URL Rewrite page, select your newly created rule.

  13. In the Actions pane, click Edit….

  14. On the Edit Rule page, click Add Conditions.

  15. In the Conditions section, click Add….

  16. In the Add Condition dialog box, create the following rule to match the host header as the key to match the entries in the OriginServers rewrite map:

    • Condition input: {QUERY_STRING}

    • Check if input string: Matches the pattern

    • Pattern: *

    • Select the Ignore case check box

    • Click OK.

  17. Repeat steps 15 and 16 to create the following rule to set the default value as # when the host header does not match the entries in the OriginServers rewrite map:

    • Condition input: {C:1}

    • Check if input string: Does not match the pattern

    • Pattern: #

    • Select the Ignore case check box

    • Click OK.

  18. On the Edit Rule page, do the following:

    • Select Track capture groups across conditions.

    • Click Server Variables.

  19. In the Server Variables dialog box, do the following:

    • In the Name column, enter HTTP_HOST.

    • In the Value column, enter {C:1}.

    • In the Replace column, select the Replace check box.

    • Click OK.

  20. On the Edit Rule page, in the Actions pane, click Apply.

To send a 400 response to requests that do not match the rewrite map (Optional)

  1. Open IIS Manager.

  2. In the Connections pane, select the server node. This is your child cache node.

  3. In the server pane, double-click URL Rewrite.

  4. On the URL Rewrite page, in the Actions pane, click Add Rules….

  5. In the Add Rules(s) dialog box, double-click Blank rule.

  6. On the Edit Rule page, create the following rule to block requests that do not match the host names that you have defined in your rewrite map, and to send a 400 response to these requests:

    • Name: Not my customer

    • Using: Wildcards

    • Pattern: *

    • Action type: Custom Response

    • Status code: 400

    • Sub-status code: 0

  7. In the Actions pane, click Apply.

Configure Parent Cache Node

You can configure ARR as the parent cache node to be used as a forward proxy. You can then define a rewrite map with a list of host names that the parent cache node will accept. You must have the disk-based cache feature configured and enabled before you continue.

To configure ARR as a forward proxy

  1. Open IIS Manager.

  2. In the Connections pane, select the server node.

  3. In the server pane, double-click Application Request Routing Cache.

  4. On the Application Request Routing Cache page, in the Actions pane, click Server Proxy Settings….

  5. On the Application Request Routing page, select Enable proxy.

  6. In the Actions pane, click Apply.

  7. In the Connections pane, select the server node.

  8. In the server pane, double-click URL Rewrite.

  9. On the URL Rewrite page, in the Actions pane, click Add Rules….

  10. In the Add Rule(s) dialog box, double-click Blank rule.

  11. On the Edit Rule page, create the following rule to make ARR a forward proxy:

    • Name: Forward proxy

    • Using: Wildcards

    • Pattern: *

    • Conditions

      • Input: {HTTP_HOST}

      • Type: Matches the pattern

      • Pattern: *

    • Action Type: Rewrite

    • Rewrite URL: https://{C:1}/{R:0}

  12. In the Actions pane, click Apply.

See Also

Concepts

ARR Tasks for ECNs and CDNs
ARR Common Tasks