Technical Information
AngularJSsingle page appUmbraco 7.3.0website, extended to register routes viaUmbraco.Core.ApplicationEventHandlerin a separate class library
Scenario
I have an AngularJS single page app (SPA) that I'm trying to pre-render via an external PhantomJS service.
I want MVC's route handler to ignore the route /?_escaped_fragment_={fragment}, so the request can be handled directly by ASP.NET and thus passed on to IIS to proxy the request.
In Theory
Umbracois built onASP.NET MVC.- Routes are configurable via
System.Web.Routing.RouteCollectionclass. - When extending
Umbracowith custom routes, any routes configured via theSystem.Web.Routing.RouteTablewill take precedence over Umbraco routes, thus never being handled byUmbraco** - Possible methods for my scenario
**I could be wrong. As far as I'm aware, custom routing takes precedence as it's done before the Umbraco routes are registered. However I'm unsure whether telling MVC to ignore a route would also prevent Umbraco from handling that route.
In Practise
I have attempted to ignore the routes with the following:
Attempt one:
routes.Ignore("?_escaped_fragment_={*pathInfo}");
This throws an error: The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.
Attempt two:
routes.Ignore("{*escapedfragment}", new { escapedfragment = @".*\?_escaped_fragment_=\/(.*)" });
This didn't result in an error, however Umbraco still picked up the request and handed me back my root page. Regex validation on Regexr.
Questions
- Can
MVCactually ignore a route based on itsquery string? - Is my knowledge of
Umbraco's routing correct? - Is my
regexcorrect? - Or am I missing something?