Last week, I posted a question about running two different app/web servers on a VPS, but using only one main incoming URL/port (using site.com instead of site.com:8080).
I received an answer that helped me make the solution work by utilizing URL Rewriting and creating inbound and outbound rules for the rewrite.
Everything works perfectly except when I have a CSS property with a relative URL value. For example:
.rule{
background-image: url(/images/picture.jpg);
}
Here are my current inbound and outbound rules:
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="java/(.*)" />
<action type="Rewrite" url="http://s17857763.onlinehome-server.com:8080/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="RewriteRelative" preCondition="IsHtml" enabled="false" stopProcessing="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="/(.*)" />
<action type="Rewrite" value="/java/{R:1}" />
</rule>
<rule name="RewriteAbsolute" preCondition="IsHtml" enabled="false">
<match filterByTags="A, Area, Base, Form, Head, IFrame, Img, Input, Link, Script" pattern="http(s)?://s17857763\.com/(.*)" />
<action type="Rewrite" value="/java/{R:2}" />
</rule>
<preConditions>
<preCondition name="IsHtml">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
<add input="{URL}" pattern=".*/java/.*" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
If you want to see the issue firsthand, open your dev console and visit
The outbound rules load normal CSS and JS links fine because they come from HTML tags, but I'm unsure if it's possible to fix the CSS URL() path.