IIS URL Rewrite issue
I was trying to implement IIS URL rewrite functionality but is is not working as it should be. There are two servers. Server1 has SQL and SSRS. Server2 has IIS installed. Both servers have Server 2022. SSRS is accessible on Server2. One domain is registered as abc.com. from abc.com, sites from Servers are accessible. For SSRS, rather that using http://server1/reports, we tried to implement URL rewrite function. if someone click for reports, it should display http://abc.com rather than http://server1/reports.
on HTML page, we have used an anchor tag to navigate to reports ( <p>To continue to Stanford Reports, click <a href=”https://abc.com/Reports/Pages/Folder.aspx?ItemPath=%2fmyreports“>here</a> </p>)
When I click this link, it is showing “Not Found” Error .
rewrite section in web.config
<rewrite>
<outboundRules rewriteBeforeCache=”true”>
<clear />
<rule name=”ReverseProxyOutboundRule1″ preCondition=”ResponseIsHtml1″>
<match filterByTags=”A, Form, Img” pattern=”href=(.*?)http://server1/Reports/(.*?)s” />
<conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” />
<action type=”Rewrite” value=”http{R:1}://abc.com/{R:2}” />
</rule>
<rule name=”Restore-AcceptEncoding” preCondition=”NeedsRestoringAcceptEncoding”>
<match serverVariable=”HTTP_ACCEPT_ENCODING” pattern=”^(.*)” />
<conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” />
<action type=”Rewrite” value=”{HTTP_X_ORIGINAL_ACCEPT_ENCODING}” />
</rule>
<preConditions>
<preCondition name=”ResponseIsHtml1″>
<add input=”{RESPONSE_CONTENT_TYPE}” pattern=”^text/(.+)” />
</preCondition>
<preCondition name=”NeedsRestoringAcceptEncoding”>
<add input=”HTTP_X_ORIGINAL_ACCEPT_ENCODING” pattern=”.+” />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name=”ReverseProxyInboundRule1″ stopProcessing=”true”>
<match url=”Reports/(.*)” negate=”false” />
<action type=”Rewrite” url=”http://server1/Reports{R:1}” logRewrittenUrl=”false” />
<serverVariables>
<set name=”HTTP_X_ORIGINAL_ACCEPT_ENCODING” value=”{HTTP_ACCEPT_ENCODING}” />
<set name=”HTTP_ACCEPT_ENCODING” value=”” />
</serverVariables>
</rule>
</rules>
</rewrite>
Can someone please suggest for this issue?
I was trying to implement IIS URL rewrite functionality but is is not working as it should be. There are two servers. Server1 has SQL and SSRS. Server2 has IIS installed. Both servers have Server 2022. SSRS is accessible on Server2. One domain is registered as abc.com. from abc.com, sites from Servers are accessible. For SSRS, rather that using http://server1/reports, we tried to implement URL rewrite function. if someone click for reports, it should display http://abc.com rather than http://server1/reports. on HTML page, we have used an anchor tag to navigate to reports ( <p>To continue to Stanford Reports, click <a href=”https://abc.com/Reports/Pages/Folder.aspx?ItemPath=%2fmyreports”>here</a> </p>) When I click this link, it is showing “Not Found” Error . rewrite section in web.config <rewrite><outboundRules rewriteBeforeCache=”true”><clear /><rule name=”ReverseProxyOutboundRule1″ preCondition=”ResponseIsHtml1″><match filterByTags=”A, Form, Img” pattern=”href=(.*?)http://server1/Reports/(.*?)s” /><conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” /><action type=”Rewrite” value=”http{R:1}://abc.com/{R:2}” /></rule><rule name=”Restore-AcceptEncoding” preCondition=”NeedsRestoringAcceptEncoding”><match serverVariable=”HTTP_ACCEPT_ENCODING” pattern=”^(.*)” /><conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” /><action type=”Rewrite” value=”{HTTP_X_ORIGINAL_ACCEPT_ENCODING}” /></rule><preConditions><preCondition name=”ResponseIsHtml1″><add input=”{RESPONSE_CONTENT_TYPE}” pattern=”^text/(.+)” /></preCondition><preCondition name=”NeedsRestoringAcceptEncoding”><add input=”HTTP_X_ORIGINAL_ACCEPT_ENCODING” pattern=”.+” /></preCondition></preConditions></outboundRules><rules><rule name=”ReverseProxyInboundRule1″ stopProcessing=”true”><match url=”Reports/(.*)” negate=”false” /><action type=”Rewrite” url=”http://server1/Reports{R:1}” logRewrittenUrl=”false” /><serverVariables><set name=”HTTP_X_ORIGINAL_ACCEPT_ENCODING” value=”{HTTP_ACCEPT_ENCODING}” /><set name=”HTTP_ACCEPT_ENCODING” value=”” /></serverVariables></rule></rules></rewrite> Can someone please suggest for this issue? Read More