Built-in API Key Services not working when hosted at the /api custom route

I have ServiceStack (v5.5) hosted at the api custom route according to https://docs.servicestack.net/mvc-integration#enabling-servicestack-in-webconfig

Everything works except requests to built-in API Key Services, which result in a 404 response.


POST http://localhost:xxx/api/apikeys/live HTTP/1.1


Handler for Request not found (404):

  Request.HttpMethod: POST
  Request.PathInfo: /keys/live
  Request.RawUrl: /api/apikeys/live

Everything works as expected when I remove the custom route, and even if I change the custom route to anything other than api. The custom route “apix” works for example.

I believe this is caused by an error in ServiceStack.Host and the method

public static string NormalizePathInfo(string pathInfo, string mode)

For the input pathInfo="/apikeys/live" and mode=“api” it returns “/keys/live” when I believe it should return “/apikeys/live”

Would be great if you could have a look at this. In the mean time my workaround is creating custom routes for these services.

Kind Regards, Anders

Thanks for the report + example, should be resolved from this commit.

This change is available from v5.5.1 that’s now available on MyGet.

1 Like