In SelfHost/OwinHost, route matching normally happens at HttpRoutingDispatcher, but when CORS is enabled, we add a message handler where we do route matching for pre-flight requests. Since this message handler runs before the HttpRoutingDispatcher, we need to make sure that we set the property on the response to indicate _Soft_ 404 Not Found response when a route doesn't match.
This bug is related to issue # 985. Once its fixed, we need to add the property "MS_NoRouteMatched" in the 404 Not Found response to indicate that its a soft response.
AttributeBasedPolicyProviderFactory.cs:
```
private static HttpActionDescriptor SelectAction(HttpRequestMessage request)
{
HttpConfiguration config = request.GetConfiguration();
if (config == null)
{
throw new InvalidOperationException(SRResources.NoConfiguration);
}
IHttpRouteData routeData = request.GetRouteData();
if (routeData == null)
{
routeData = config.Routes.GetRouteData(request);
if (routeData == null)
{
throw new InvalidOperationException(SRResources.NoRouteData);
}
request.Properties[HttpPropertyKeys.HttpRouteDataKey] = routeData;
}
```
Comments: Yao, can you take a look at this? It's not clear exactly what work needs to be done here or in issue #985 (also assigned to you). If either of these bugs don't seem like there needs to be any change, please email triage with your thoughts.
This bug is related to issue # 985. Once its fixed, we need to add the property "MS_NoRouteMatched" in the 404 Not Found response to indicate that its a soft response.
AttributeBasedPolicyProviderFactory.cs:
```
private static HttpActionDescriptor SelectAction(HttpRequestMessage request)
{
HttpConfiguration config = request.GetConfiguration();
if (config == null)
{
throw new InvalidOperationException(SRResources.NoConfiguration);
}
IHttpRouteData routeData = request.GetRouteData();
if (routeData == null)
{
routeData = config.Routes.GetRouteData(request);
if (routeData == null)
{
throw new InvalidOperationException(SRResources.NoRouteData);
}
request.Properties[HttpPropertyKeys.HttpRouteDataKey] = routeData;
}
```
Comments: Yao, can you take a look at this? It's not clear exactly what work needs to be done here or in issue #985 (also assigned to you). If either of these bugs don't seem like there needs to be any change, please email triage with your thoughts.