locked
Getting SSRS to work with ARR (Application Request Routing) URL Rewrite RRS feed

All replies

  • User1702751832 posted

    I know this is an old thread... Were you able to get URL rewrite working for your environment?

    Thursday, November 7, 2013 11:54 AM
  • User-1580627810 posted

    In reference to this post: http://forums.iis.net/t/1186999.aspx

    Our reason to get use ARR with IIS and URLRewrite is to

    1. Not expose our SQL Server to an external IP
    2. Use IIS URLRewrite to block calls not coming from a single HTTP_REFERER

    Since SSRS is not hosted in IIS and it's own entity, URLRewrite does not apply directy to SSRS. 

    Our environment:

    • IIS7
    • SSRS 2012
    • ARR 3.0
    • URLRewrite 2.0

    Sample SQL Server: SQL

    Sample External Server: external.site.com

    I followed the ARR + IIS + URLRewrite examples in many blogs. The result of the web.config was that

    1. Reports did not render the report;
    2. CSS Styles/Images were missing.

    The web.config was similar to this and placed in the root of the 'external server'.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>                
            <rule name="Route the requests for Report Server" stopProcessing="true">
                        <match url="^ReportServer/(.*)" />
                        <conditions>
                            <add input="{CACHE_URL}" pattern="^(https?)://" />
                        </conditions>
                        <action type="Rewrite" url="{C:1}://<some server>/ReportServer/{R:1}" />
                        <serverVariables>
                            <set name="HTTP_ACCEPT_ENCODING" value="" />
                        </serverVariables>
                    </rule>
                </rules>
                <outboundRules>
              
            <rule name="ReverseProxyOutboundRule2" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://<some server>/ReportServer/(.*)" />
                        <action type="Rewrite" value="/ReportServer/{R:2}" />
                    </rule>
            <rule name="RewriteRelativePaths2" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" negate="false" />
                        <action type="Rewrite" value="/ReportServer/{R:1}" />
                    </rule>
                    <preConditions>
                        <preCondition name="ResponseIsHtml1">
                            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                        </preCondition>
                    </preConditions>
                </outboundRules>
            </rewrite>
        </system.webServer>
    </configuration> 

    Well, finally got it to work 100%, after scratching my head a lot and pulling some hair out... this is the correct web.config that makes it work.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.net>
    <mailSettings>
    <smtp from="xxxx">
    <network host="xxxx" />
    </smtp>
    </mailSettings>
    </system.net>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
    <match url="(.*)" />
    <action type="Rewrite" url="http://sql/{R:1}" />
    </rule>
    </rules>
    <outboundRules>
    <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
    <match filterByTags="A, Form, Img" pattern="^http(s)?://sql/(.*)" />
    <action type="Rewrite" value="http{R:1}://external.site.com/{R:2}" />
    </rule>
    <preConditions>
    <preCondition name="ResponseIsHtml1">
    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
    </preConditions>
    </outboundRules>
    </rewrite>
    </system.webServer>
    </configuration>

    Simply said...

    1. Go to IIS
    2. Create a Site
    3. At the Root of the Site, use URLRewrite
    4. In URLRewrite, create a new rule. Select the "Reverse Proxy" template
    5. Fill in the blank
    6. Tada....

    Thursday, May 22, 2014 2:18 PM
  • User-1603235805 posted

    hi, sorry to resurrect this old thread. I'm trying to implement this on IIS 10 and SSRS 2014 but I'm getting an errror "HTTP Error 401.1 - Unauthorized, You do not have permission to view this directory or page using the credentials that you supplied."

    will this work with a SSRS with forms authentication?

    This is my configuration

    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="ReverseProxyInboundRule12" stopProcessing="true">
    <match url="(.*)" />
    <action type="Rewrite" url="http://dbserver.intranetdomain.com/{R:1}" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^dbserver.publicdomain.com" />
    </conditions>
    </rule>
    </rules>
    <outboundRules>
    <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
    <match filterByTags="A, Form, Img" pattern="^http(s)?://dbserver.intranetdomain.com/(.*)" />
    <action type="Rewrite" value="http{R:1}://dbserver.publicdomain.com/{R:2}" />
    </rule>
    <preConditions>
    <preCondition name="ResponseIsHtml1">
    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
    </preConditions>
    </outboundRules>
    </rewrite>
    </system.webServer>
    </configuration>

    Friday, January 27, 2017 5:35 AM