Home > Blog > 2016 > 01 > Running Umbraco Over Reverse Proxy

Running Umbraco Over Reverse Proxy

Recently I had to get Umbraco working over a reverse proxy, and I thought I'd share how I did it, as there's actually a pretty painless way to get it working!

First up, what is a reverse proxy? A reverse proxy is like a virtual folder, except that the contents of the virtual folder resides on another server. Why would you need to do this? Well, usually, if you need to run Umbraco in a virtual folder in a .Net site, you could use a normal virtual folder. However, security considerations might prevent installing the Umbraco site on the same box as the main site, or the main site might be written in PHP and hosted on a *nix box for example.

Out of the box, platforms like Apache support reverse proxying natively through Mod Rewrite. In IIS, you have to use something called Application Request Routing (ARR), combined with URL Rewritiung to make it work. These are optional add ons for IIS. If you're interested, here's some information on how to do it with Mod Rewrite, and here's how to set up ARR in IIS.

One of the things that you often have to do with reverse proxied stuff is to rewrite the content as it's sent back to correct image paths and links etc. Normally you'd do this with outbound rewrite rules. It's not too painful for simple sites, but for something like Umbraco, which is a very complex system, it can be quite difficult to do without accidentally breaking stuff (you also need to heavily rewrite the contents of JS and CSS files, which can be quite slow, and each extra plugin increases the work usually).

So I figured out a much easier way of getting it all to work. Lets say you have www.mysite.com and you want to reverse proxy the URL www.mysite.com/blog/ to blog.mysite.com, which is an Umbraco site on another server. All you need to do is set up the Umbraco site on blog.mysite.com to run in a virtual folder that matches the name that you want to use for the reverse proxy, e.g. blog.mysite.com/blog/. As Virtual folder setups work pretty well out of the box, this means that you only need an outbound rule for the blog.mysite.com domain, everything else should just work out of the box, as it already thinks it's in the /blog/ folder!

Enter Comment

1 comment for “Running Umbraco Over Reverse Proxy”

  1. Gravatar of PatPat
    Posted 03 April 2016 at 20:05:20

    Hey Tim we are trying to achieve something similar with 2 umbraco sites, can you please expand a little on how you setup your rules in IIS? When you say "virtual folder" do you mean virtual directory in iis? We tried this but the site needed to be setup as an application and then we encountered my issues as per : https://our.umbraco.org/forum/developers/api-questions/64995-Setting-up-Umbraco-as-a-subsite-inside-another-Website-Virtual-Directory-converted-to-application-in-IIS#comment-243796

    Any help would be appreciated