Nick Karnik - 224 - Sep 26, 2014

Other than prefixing every DTO Route with “/api”, what is the best way to configure SS to serve static content from root ("/") and service endpoints from ("/api")? Should I do a url rewrite on the RawHttpHandler? If yes, how would I do that?

If you want ServiceStack to serve the static content (i.e. instead of the underlying ASP.NET WebApp) than you would need to prefix routes with /api, but this can be automated for all routes with:

Stephen Brannan:

This is pretty sweet feature. I didn’t know this was available. When was this added?

Going to guess and say towards the start of the year :slight_smile:

Nick Karnik:

Thanks! For Auth, I had to do the following:

 var routes = authFeature.ServiceRoutes;

                foreach(var route in routes) {
                    for(int i = 0; i < routes[route.Key].Count(); i++) {
                        routes[route.Key][i] = “/api” + routes[route.Key][i];

For other plugins, I was able to set the service path in the constructor parameters.

Sir Thomas:

That’s awesome - wish I had noticed this months ago!