2

I'm currently trying to implement an Owncloud system at our company. I have the Owncloud system up and running on an internal webserver which is behind a firewall. I can access the installation internally by navigating to servername.company.co.nz/owncloud

We have an IIS webserver that is public facing (SBS 2012). I'd like to use this as a reverse proxy to the cloud installation. I have read a few articles and tutorials on how to achieve this using URL Rewriting and ARR on IIS - this one in particular seemed like a good start : IIS 7 Reverse Proxy based on domain name host?

But so far I have not been able to create any reverse proxy rules that work.

Basically, I would like a subdomain cloud.company.co.nz to reverse proxy to the internal webserver path server.company.co.nz/owncloud have not been able to figure out how to achieve this.

I currently have a new website on out IIS server which is bound to the cloud.company.co.nz hostname, but that's about all I've been able to accomplish without knocking over our Exchange Web Services.

Please bear in mind I am an IIS newbie. Any help is greatfuly received at this stage.

Edit 1:

As per @jotap's suggestion, my web.config now looks like this. However, all I get is a 503 error. Any ideas as to why I would get this? Also, where should I be looking in terms of logs etc for clues?

Cheers

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="ReverseProxyInboundRule1" enabled="false" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://1.2.3.4/owncloud{R:1}" /> </rule> </rules> <outboundRules> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="false"> <match filterByTags="A, Form, Img" pattern="^http(s)?://1.2.3.4/owncloud/(.*)" /> <action type="Rewrite" value="http{R:1}://cloud.company.co.nz/{R:2}" /> </rule> <preConditions> <preCondition name="ResponseIsHtml1"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> </preCondition> </preConditions> </outboundRules> </rewrite> </system.webServer> </configuration>

1
  • Keep it simple while testing and do only inbound rules first, once you have that working work on your outbound rules.
    – jotap
    Feb 22, 2016 at 4:25

1 Answer 1

0

The devil is in the detail when it comes to reverse proxying with IIS and ARR, the basic steps to achieve this are:

  • Install ARR and URLRewrite
  • Configure ARR for reverse proxying: Server level of IIS --> Application Request Routing Cache --> Server Proxy Settings
    • The most basic setup that should get you going is "Enable Proxy" and leave the rest as is.
  • Configure the site to proxy all requests to the new host. This can be done through the GUI, alternately you can use this web.config to get you going (put it in the root of the site that is doing the proxying):

    <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="inbound"> <match url="(.*)" /> <action type="Rewrite" url="http://server.company.co.nz/owncloud/{R:0}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

Not sure if you're familiar with regular expressions, that is basically saying, "capture the URL after the host name, and make a request to server.company.co.nz, tacking the captured URL on to the end of the owncloud subdir".

Note that you may have issues if the site on the back end is compressing the content (you'll get a 500 error). In addition if it works you may find all your images and CSS are broken, in which case and you'll have to do configure outbound rewriting also, but that depends on your back end and the rules are specific to the issues you may have so see how you go. You may have to do another dozen tweaks (or more) to get it right.

5
  • Thanks @jotap. I think I was 90% there but was missing something. will try your suggestion and report back. Feb 21, 2016 at 4:35
  • I've added my new rewrite rules as above, but so far I'm only getting a 503 error. I've also added a DNS entry cloud.company.co.nz to point to my IIS server IP. Feb 22, 2016 at 3:20
  • If you hit the page on the local machine it should show you the full error details, not just the 503 part, or you can enable failed request tracing to do the same.
    – jotap
    Feb 22, 2016 at 4:22
  • I'm doing all my testing internally first, and I'm firstly trying to hit the page from the IIS server doing the proxy. And you're right - I would expect to see a blue IIS error page - but all I get is a plain old HTTP Error 503. I have removed my outbound rule as suggested, but this hasn't helped. Interestingly, if I stop the site in the IIS manager, I can hit the IIS default home page. Should I be looking at my bindings as a source of my trouble first? Feb 23, 2016 at 6:52
  • If you stop the site and get a different page it means your bindings are working. If you're using the server itself and it knows that then it should give you a detailed error page. Put an entry for the host name in your hosts file if it's not. Alternately enable failed request tracing and check out the logs. iis.net/learn/troubleshoot/using-failed-request-tracing/…
    – jotap
    Feb 24, 2016 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .