So remove the MetaDataFeature
in the AppHost Configure method:
SetConfig(new HostConfig {
EnableFeatures = Feature.All.Remove(Feature.Metadata)
});
Then create this simple MetaData service, that redirects to Swagger.
[Route("/metadata/{cmds*}", "GET")]
public class RedirectToSwaggerRequest : IReturnVoid
{
public string cmds { get; set; }
}
[Restrict(VisibleLocalhostOnly = true)]
public class MetadataService : Service
{
public void Get(RedirectToSwaggerRequest request)
{
base.Response.Redirect("/swagger-ui");
}
}
Note: {cmds*}
in the route above will catch requests for /metadata
, /metadata/something
& /metadata/somethingelse
etc.
Then when a request goes to /metadata
then it will redirect to Swagger instead.