Base URL with path resetting

My ServiceStack API is in a subdirectory, ie.

https://www.domain.com/sub/api

Whenever, I right click on my service model and choose “Update Service Stack Reference”. The BaseURL at the top of my ServiceModel.dtos.cs gets set back to https://www.domain.com

Then I can’t update again until I change it back to https://www.domain.com/sub/api

Anyway I can fix this?

Come to think of it–all the links on the metadata page don’t work either:

https://www.domain.com/sub/api/json/metadata
point to:
https://www.domain.com/json/metadata?op=AcceptRequestedGuest
Instead of:
https://www.domain.com/sub/api/json/metadata?op=AcceptRequestedGuest

How can I tell my ServiceStack API (self hosted behind a reverse proxy) about it’s actual location?

You should be able to set the AppHost PathBase to a prefix for the API as required. Optionally, it will detect the use of ASPNETCORE_APPL_PATH if that is set.

Can you try /sub/api/metadata path links, are they also not working?

Let us know how you go.