Question

So my environment is C# asp.net sitefinity webforms / mvc / webapi hybrid. I have an application pool in IIS 7 sitting behind an Amazon elb.

I have a site foo.com in IIS. I have added an application to foo.com called bar. So my other site can be accessed by foo.com/bar.

These two sites work fine (for the most part). But sometimes when I access the same url that belongs to foo.com/bar/* I will get a 404 error, I hit enter on the browser address bar and it shows again. The 404s are hard to replicate some times I get a page rendered, some times I get a 404.

The thing is the 404 page I get is from foo.com, not foo.com/bar.

So it looks like sometimes foo.com is trying to resolve the url instead of foo.com/bar resolving the url.

I noticed that https traffic coming into the elb is sent to my application as http, so maybe the elb does something funny some times but not others?

Anyway, to troubleshoot I want my application at foo.com to ignore all url requests to foo.com/bar, so if i still get 404s I at least want the 404 page from the sub application (foo.com/bar).

So I am thinking of adding this rule to foo.com web.config

<rule name="Ignore bar" stopProcessing="true">
  <match url="^.*foo.com/bar/.*" />
  <action type="None" /> 
</rule>

But I'm unsure what the action does. What does the none do? My intention is to have foo.com ignore the url and have foo.com/bar get the url if the regex is matched.

foo.com/bar is in test mode but foo.com is a live site, so I don't want to break anything.

btw I don't get 404s to foo.com/bar/* on my dev or staging environments (where the IIS applications are setup in teh same format as live).

The main difference seems be be the Amazon environment, but I could be wrong.

So will my rule work? Or is there a better way?

Edit: I don't know if this is related, but on my amazon instances sitefinty shows I have some HTTP PUT errors (when the elb I guess is trying to PUT something to my sub application (foo.com/bar), the error is a timeout).

Edit 2: When trying a Get call to a WebApi method (to foo.com/bar) on https I always get a 404 from foo.com. But the same url on http and I get the expected data, this seems to be consistently reproducible.

Was it helpful?

Solution 2

I solved this.

The problem was above the amazon ELB we have ANOTHER akamai load balancer. Akamai was caching certain urls and sending them to the wrong server so we got a 404 because the sub application wasn't on the server that Akamai was sending the request too.

Cleared the Akamai cache and now all the requests are working / hitting the correct server and application.

I didn't include this information in my question because I didn't know the live environment was setup this way.

OTHER TIPS

Try doing the following. On the webconfig of the child application. (foo.com/bar.)

Clear the rules and then define what you need:

<rules>
   <clear />
   <!-- Define your subapplication rules if needed -->
</rules>

That statement clear all inherited rules from parent application.

You can algo use:

    <location path="." inheritInChildApplications="false">

All the lines wrapped between tags on the parent application would not be inherited to the child application

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top