Apologize if the title is not clear, basically I have a web proxy that listening on port 80 and I set up URL rewrite on IIS, (the rule on web.config as following), it does
http://example.com/api/blah/blah ->
http://example.com:8095/api/blah/blah
<rule name="api-example" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^.*/api/.*$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:8095/{R:0}" appendQueryString="true" logRewrittenUrl="false" />
</rule>
it works fine, no problems, also works when I request localhost:8095 directly
but I'd also like to be able to recognize if a request was directly requested or it was via URL rewrite module.
My idea is, to append a query string onto the URL, when the url gets rewrited on IIS so that I can check if the query string exists then it was via URL rewrite if not, then it's a direct request
examples:
http://example.com/api/blah/blah?from=proxy -> http://example.com:8095/api/blah/blah?from=proxy
http://example.com/api/blah/blah?existing_query_string=blah&from=proxy -> http://example.com:8095/api/blah/blah?existing_query_string=blah&from=proxy
How can I achieve this? or is there any other way to do it?
Many thanks
Ming
You can try to access
and compare it to Request.Url.PathAndQuery. Alternatively,
should also contain the original URL.