Sitecore 9.3 CM with reverse proxy and Identity Server

I published my last post a long time ago, but I faced new challenges while upgrading a Sitecore infrastructure from 9.0.1 to 9.3. As you all probably know, Identity Server is used as primary authenticator for CM environments by default.

In this particular infrastructure we have blue-green deployments enabled also for CM, therefore we use a reverse proxy to route the requests to blue or green IIS sites. Below, how our infrastructure looks like in a simple diagram.

To make this work I had to configure the reverse proxy, Sitecore and Identity Server a bit different compared to the default configuration.

1. Reverse proxy configuration

The reverse proxy is just an IIS site with the following web.config with active routing. The outbound rule is important to overwrite the Location variable in the response header, if this rule is not there then Sitecore will redirect you to or after the login.

<?xml version="1.0" encoding="UTF-8"?>
<rule name="ReverseProxyInboundRule" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="{R:1}" />
<rule name="ReverseProxyOutboundRule1" preCondition="IsRedirection">
<match serverVariable="RESPONSE_Location" pattern="^http(s)?://*)" />
<action type="Rewrite" value="http{R:1}://{R:2}" />
<rule name="ReverseProxyOutboundRule2" preCondition="IsRedirection">
<match serverVariable="RESPONSE_Location" pattern="^http(s)?://*)" />
<action type="Rewrite" value="http{R:1}://{R:2}" />
<preCondition name="IsRedirection">
<add input="{RESPONSE_STATUS}" pattern="3\d\d" />

2. Sitecore configuration patch

To redirect the user after login to the correct domain, you need to have the following Sitecore config patch:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="" xmlns:role="" xmlns:set="" >
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<sc.variable name="identityServerAuthority" value="https://identity.server" />
<!-- Fill the FederatedAuthentication.IdentityServer.CallbackAuthority setting if you need another host to receive callbacks from IdentityServer. It is useful for reverse proxy configuration. -->
<setting name="FederatedAuthentication.IdentityServer.CallbackAuthority" value="" />

3. Identity Server configuration

The last step is to configure identity server to approve requests from the domain:

<?xml version="1.0" encoding="utf-8"?>

Thank you for Sitecore Support for pointing me to the right path to make this work! I hope it helps to you and to future me 🔮

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s