Accessing Subsonic through IIS 8.5 URL Rewrite (with https)
Posted: Tue Oct 21, 2014 3:36 pm
I read much of csobsidian's "Setup Subsonic on IIS 7 (Windows Home Server 2011) - ARR 2.5" tutorial, but was unsuccessful in setting it up his way. I instead decided to leave subsonic set up the way I had, and try my hand at URL Rewriting in IIS 8.5. I have an A record created to point to my server's IP address for my domain name, and also have an SSL certificate installed. Note that I also am tinkering with ownCloud and want to add other services and roles to my server, so it is not strictly a server for subsonic.
With the SSL certificate, I setup an HTTP to HTTPS redirect in my web.config file, located in the wwwroot folder of my server.
Modules installed:
Application Request Routing
URL Rewrite
I used the following resources for my setup:
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing
http://forum.wegotserved.com/index.php/tutorials/article/98-configure-iis-for-reverse-proxy/
Subsonic Settings:
Subsonic 5.0 is installed and is running on port 4040. The context path is also set to "/music".
Application Request Routing Settings:
In the ARR module, I selected "Enable proxy" and hit "Apply".
URL Rewrite:
Under the HTTP/HTTPS redirect rule in web.config, I added the following rule for "localhost/music/" to rewrite to "localhost:4040/music/".
Success! I can access "mydomain.com/music/" which then redirects to "https://mydomain.com/music/" and it loads subsonic as if I were accessing it as "mydomain.com:4040/music".
The only issue that I have is a small one, but is a nuisance. I cannot figure out how to access "mydomain.com/music" without having to include the last "/". I tried removing the slashes from the match and rewrite in my rule, but it only breaks it. Any ideas?
Mike
With the SSL certificate, I setup an HTTP to HTTPS redirect in my web.config file, located in the wwwroot folder of my server.
- Code: Select all
<rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
Modules installed:
Application Request Routing
URL Rewrite
I used the following resources for my setup:
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing
http://forum.wegotserved.com/index.php/tutorials/article/98-configure-iis-for-reverse-proxy/
Subsonic Settings:
Subsonic 5.0 is installed and is running on port 4040. The context path is also set to "/music".
Application Request Routing Settings:
In the ARR module, I selected "Enable proxy" and hit "Apply".
URL Rewrite:
Under the HTTP/HTTPS redirect rule in web.config, I added the following rule for "localhost/music/" to rewrite to "localhost:4040/music/".
- Code: Select all
<rule name="Subsonic 4040 Proxy Redirect" enabled="true" stopProcessing="true">
<match url="^music/(.*)" ignoreCase="true" />
<action type="Rewrite" url="http://localhost:4040/music/{R:1}" />
</rule>
Success! I can access "mydomain.com/music/" which then redirects to "https://mydomain.com/music/" and it loads subsonic as if I were accessing it as "mydomain.com:4040/music".
The only issue that I have is a small one, but is a nuisance. I cannot figure out how to access "mydomain.com/music" without having to include the last "/". I tried removing the slashes from the match and rewrite in my rule, but it only breaks it. Any ideas?
Mike