---
title: Running Kentico behind a proxy server
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you wish to host Kentico behind a proxy server or some other service that masks the application's original domain (e.g., [Azure Application Gateway](https://azure.microsoft.com/en-in/services/application-gateway/)), you need to ensure request URLs from all parts of the application are generated correctly (targeting the proxy domain). Otherwise, you may encounter issues with [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) policies when performing certain actions (such as uploading images to [Media libraries](https://docs.kentico.com/k12sp/managing-website-content/working-with-files/media-library-files.md)).

> **Note:** **Hotfix 12.0.35 required**
>
> To configure Kentico running behind a proxy server using this approach, you need to have [hotfix 12.0.35](https://devnet.kentico.com/download/hotfixes) or newer installed.  

## Configuring Kentico running behind a proxy server

The configuration slightly differs based on your project's development model:

- [Portal Engine projects](#configuring-portal-engine-projects)
- [MVC projects](#configuring-mvc-projects)

## Configuring Portal Engine projects

For [Portal Engine projects](https://docs.kentico.com/k12sp/developing-websites/portal-engine-development-overview.md), set the **CMSUrlHost** _web.confi&#x67;_&#x6B;ey to the [host](https://en.wikipedia.org/wiki/URL#Syntax) component of the proxy server's URL (omitting the port number): 

1. Edit your Kentico project's **web.config** file.
2. Add the **CMSUrlHost** key into the  section of the file. Set the key's value to the host component of the proxy server's URL (omitting the port number).

   - For example, assuming the site is running behind the _https://my.proxyserver.com_ proxy server, add the _CMSUrlHost_ key with the _my.proxyserver.com_ value to the  section of the Kentico project's &#x77;_&#x65;b.config_ file:

   ```csharp

   <add key="CMSUrlHost" value="my.proxyserver.com" />

   ```
3. Save the _web.config_ file.

The system is now configured to generate URLs targetting the specified proxy server.

## Configuring MVC projects

For [MVC projects](https://docs.kentico.com/k12sp/developing-websites/mvc-development-overview.md), you need to:

1. [Set the CMSUrlHost web.config key for the live site MVC application](#setting-the-cmsurlhost-web.config-key)
2. Configure the MVC site's Presentation URL property

### Setting the CMSUrlHost web.config key

On the MVC live site, set the **CMSUrlHost** _web.confi&#x67;_&#x6B;ey to the [host](https://en.wikipedia.org/wiki/URL#Syntax) component of the proxy server's URL (omitting the port number).

1. Edit your MVC project's **web.config** file.
2. Add the **CMSUrlHost** key into the  section of the file. Set the key's value to the _host_ component of the proxy server's URL (omitting the port number).

   - For example, assuming the site is running behind the _https://my.proxyserver.com_ proxy server, set the key to _my.proxyserver.com_:

   ```csharp

   <add key="CMSUrlHost" value="my.proxyserver.com" />

   ```
3. Save the _web.config_ file.

### Setting the MVC site's Presentation URL property

Configure the **Presentation URL** property (via the **Sites** application) of the front-end MVC site to target the proxy server's domain:

1. Open the Kentico administration interface in your browser.
2. Navigate to the **Sites** application and edit the MVC site.
3. Set the **Presentation URL** property to the full domain name of the proxy server.
   - For example, assuming the site is running behind the _https://my.proxyserver.com_ proxy server, set _Presentation URL_ to _https://my.proxyserver.com_.
4. **Save** the changes.

The system is now configured to generate URLs targetting the specified proxy server.
