PathBase and JSON /api pre-defined route

So with no PathBase set on the host config:

/ui returns UI interface.
/api returns json api index.

As expected.

When setting the PathBase to say /backend

Then /backend/ui works fine.

However /backend/api is not found.

Am I missing something?

Are you using the latest ServiceStack v6.8?

@dandcg The PredefinedRoutesFeature disables this route when custom PathBase is being used in your configured AppHost.

Both,

Yes, I’m using v6.8.

I missed that bit of code - I presume I can implement this as an override. Will try shortly.

However, is there a reason why this is implemented this way?

Swapping JsonServiceClient to JsonApiClient fails for requests that rely on the fallback route when a PathBase is set. This doesn’t feel overly intuitive when /ui works and also, /json/reply works this way.

Cheers,

Dan

The JsonApiRoute is only enabled when no PathBase is set which causes conflicts.

JsonServiceClient is configured to use the pre-defined route whilst JsonApiClient is configured to use the default JSON /api route which isn’t enabled when using a custom PathBase.

I’ve managed to override using the code that would have been run if PathBase wasn’t set. Are you saying that there are potential conflicts I should watch out for?

Most of the time when PathBase is used, it’s to mount ServiceStack from /api which breaks the built-in /api JSON API route, so we just disable the feature. We need to do more testing, but we can look at not removing it if a different PathBase is used.

The JSON /api route is now being added if you have a PathBase which doesn’t contain an api in it, i.e. so you should now be able to use a /backend PathBase.

This change is available from v6.8.1+, that’s now available on MyGet.

@mythz as per usual sir you are an absolute gentleman.