As a developer, I'd like to redirect certain (AJAX) requests to a DEV server rather than my local webserver.
For Example, redirect request for the subdirectory of "AbcService":
http://localhost/AbcService/json?queryString
http://dev.example.com/AbcService/json?queryString
I do not want to redirect other requests for localhost, e.g.:
http://localhost/XyzService/...
I thought I could do this with the IIS UrlRewrite 2.0 extension, but thus far I haven't been able to come up with a rule that works.
First, I'm not sure if I need a Rewrite or Redirect action. I can get the Redirect action to work, but no data is returned. Possibly authentication issues.
Here are the rules:
URL: *
Conditions:
{HTTP_HOST} matches "localhost"
{URL} matches "*/AbcService/*
Action:
Redirect (307)
URL: http://dev.example.com/AbcService/{C:2}
Where {C:2} is the path following "/AbcService/" from the {URL} condition.
One thing I don't understand is why switching this from a Redirect to Rewrite action results in a 404, even though I have the exact same conditions.