1

I have written an ASP.NET Web API which is basically an API gateway. The base URL of the gateway is http://localhost:88/ApiGateway. The service I have implemented looks up some header values and cookies in order to route a request. Currently I use it for blue-green deployments.

When a header or cookie with a specific API-ID is found, the request is routed to the corresponding API.

For example, if the found API-ID is alpha-v1.7.4, and the URL is http://localhost:88/gateway/app/login.html, the request is routed to http://localhost:8080/app/alpha-v1.7.4/app/login.html where the actual app or website resides.

This work perfectly when using OWIN and Katana. All URLs are routed correctly.

When installing the gateway in IIS, things are getting strange.

I have put a very verbose logging into the gateway which logs each request and the found route. On IIS I observe that the followings requests are reaching the gateway and are routed properly:

1: http://localhost:88/gateway/app/some_directory/
2: http://localhost:88/gateway/app/another_directory_with_a.dot/
3: http://localhost:88/gateway/app/some_path_no_trailing_slash

The following request do not reach the gateway:

4: http://localhost:88/gateway/app/no_trailing_slash_with_a.dot
5: http://localhost:88/gateway/app/index.html

To me it seems that IIS is letting pass any directory paths (i.e. with a trainling slash like .../.../directory/), all resource path (i.e. with no trailing slash like .../.../resource) which do not smell like a file (since they have not dot), but blocks paths which have no trailing slash but a dot inside (.../.../may_be_a.file is blocked, but .../.../not_a.file/ passes).

Following these instruction did not work for me: How to disable Request Filtering for a specific website on IIS 7.5?

Any idea how to configure IIS to get this to work?

Community
  • 1
  • 1
Peter Perot
  • 1,003
  • 1
  • 10
  • 15
  • I don't know how you're doing your redirects. But perhaps you need to [RAMFAR](http://stackoverflow.com/questions/11048863/modules-runallmanagedmodulesforallrequests-true-meaning) it. – mason Apr 07 '17 at 20:21
  • @mason: RAMMFAR does not work for me - don't know why not, but I came around with a different solution. – Peter Perot Apr 10 '17 at 11:23

1 Answers1

2

After messing around with RAMMFAR which did not work for me, I came around with this solution:

<system.webServer>
  <handlers>
    <clear />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

Just clearing all handlers and adding the one and only I need solved the problem.

Community
  • 1
  • 1
Peter Perot
  • 1,003
  • 1
  • 10
  • 15