Reverse Proxy (with IIS)

I run a lot of different pieces of software on my server. Sonarr, Radarr, Lidarr… just to name a few.
All of these different systems listen on different ports, and I got tired of having so many ports forwarded and so many different ports to remember.

Enter: Reverse Proxy.

First: what is it?

A reverse proxy allows you to pass traffic from one thing to another transparently in the background.
What this means is that I can have an application listening on a different port to my webserver, and have my web server silently pass traffic across to that application. From a user viewpoint, it’s just a website over https (that nice green secure site rating). Much nicer.

Second: how do I use it?

Pretty easily, as it happens.
First, I need to install a few components for IIS – namely URL Rewrite and Application Request Routing. I used the Web Platform Installer to do this bit.

After that, I set up the base site in IIS. It’s listening on ports 80 and 443 (http and https). I created subdirectores from the site folder (/sonarr, /radarr, /lidarr, /mylarr etc).
I then set each application to use the subdirectory as a ‘baseurl’, so that they reply nicely. Mylar listened on localhost:6767/mylar once the baseurl was set, for example.
I created a proxy rule in each ‘sub’ path, to match the application it was going to be for. url/radarr passes content to localhost:7878/radarr, url/sonarr to localhost:8989/sonarr, and so on.
With that set, I restarted IIS to apply the changes, and… voilĂ ! I have SSL via the base site in IIS, and don’t have to remember the individual ports for each application.

This is the web.config file for redirecting url/mylar to the mylar application

Third: why bother?

Anyone running Radarr/Sonarr/Lidarr/Mylar etc has probably input the wrong port for the application at some point. I did many times. I also got tired of having to forward so many different ports for my system to work nicely; and every now and then the firewall at work would complain about weird ports trying to pass http traffic. Now? No more firewall complaints, because it’s https traffic over the standard https port. I don’t have to port forward, or remember the individual ports. I go to site/service, and it silently passes my query from there to the relevant application listening in the background.

The result?
A happy me!

Permanent link to this article: