2

I have two domains: first.com and second.com. In these domains there are two ASP.NET applications hosted in IIS 7.

Page in application http://first.com.index references a script which source is http://second.com/script.js Script is doing some ajax POST but browser is blocking is because cross domain restriction.

Is it possible to create rule on IIS so a specific request for http://first.com/script.js would be passed to http://second.com/script.js (executed there and returned to client) ?

I tried to add rewrite rule in first.com but it does not work:

<system.webServer>
        <rewrite>
            <rules>
                <rule name="test" enabled="true" stopProcessing="false">
                    <match url=".*/script.js" />
                    <action type="Rewrite" url="http://second/script.js" appendQueryString="false" logRewrittenUrl="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

Action type="Redirect" works but it is not what I am looking for cause it returns 302 response to client. I want pass request directly to second application instead.

Mike B
  • 12,768
  • 20
  • 83
  • 109
jlp
  • 9,800
  • 16
  • 53
  • 74

0 Answers0