Page 1 of 1

Accessing Subsonic through IIS 8.5 URL Rewrite (with https)

PostPosted: Tue Oct 21, 2014 3:36 pm
by eptesicus
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.
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

Re: Accessing Subsonic through IIS 8.5 URL Rewrite (with htt

PostPosted: Mon Apr 25, 2016 6:05 pm
by csobsidian
Were you able to fix your issue with the trailing "/"?

Cheyenne

Re: Accessing Subsonic through IIS 8.5 URL Rewrite (with htt

PostPosted: Wed Jan 10, 2018 3:22 pm
by thefad3done
I know this is an old topic now, but in case anyone was wondering:

I got around this issue by creating a Virtual Directory of "music" and setting up the rewrite rule on that virtual directory instead of the root.