Views: 432
Number of votes: 5
Average rating:

Support for ApplicationHost transforms in DXC Service

As of 16th October 2017, Episerver Digital Experience Cloud Service supports ApplicationHost transforms enabling you to modify configuration elements that isn’t exposed in Azure as it was in your IIS management console.

We can create a file named applicationHost.xdt that makes these system configurations as a part of the website configuration ensuring that the settings also get propagated when using automatic scaling.

To make applicationHost transforms in DXC Service you have two options:

  1. The usage of one (1) applicationHost.xdt-file
  2. The usage of environment-specific files, one for each target environment. For example:
  • applicationHost-Preproduction.xdt
  • applicationHost-Production.xdt

Since the DXC deployment engine won’t run the deployment to the Integration environment, you can just add a “applicationHost.xdt” file to that environment if you want to use alternative number 2. We will exclude the applicationHost.xdt file from the code package when moving the deployment to Preproduction/Production environments and apply the environment specific file instead.

Potential use-case

By utilizing applicationHost transform you can make your Web App in DXC Service to also act as a proxy, forwarding requests to another site/web app but replace it with the target URL of your site. Let’s say that you have two sites, one company site (DXC Service) and one blog (external blog service) and you want to achieve the following behaviour for your visitors:

Site 1:  company.com
Site 2:  company.com/blog (actually using company.bloghost.com)

To achieve this, you need to rewrite and forward all requests for company.com/blog to the location of your blog (company.bloghost.com) by doing the following in your web app:

  1. Create an applicationHost.xdt and enable proxy.
  2. Add rewriting rules to web.config.
  3. Publish applicationHost.xdt to /site.
  4. Publish web.config changes.

Example of how the rewrite rule in web.config can look:

<rules>
<rulename="Proxy" stopProcessing="true">  
<matchurl="^blog/?(.*)" />  
<actiontype="Rewrite" url="http://company.bloghost.com/{R:1}" />  
</rule>
</rules>

With everything in place our blog will be accessible through company.com/blog instead of using the original address company.bloghost.com.

Note: The forwarded requests will still count as a page view in your DXC Service environment.

 

 

    (By Linus Ekström , 15 November 2017 02:49, Permanent link)

    Hi David!

    Thanks for a good post. The reverse proxy case is actually something that we could use for a customer. Do you know if someone has managed to implement this fully as a reverse proxy, so that both incoming requests but also outgoing links are generated to change the URL? The reason that I am asking is that I have a cusomer that has a lot of web sites, and they would like to change from using sub domains (abc.company.com) to using the main site with a suffix (company.com/abc).

  Please login to post a comment