Shane van Wyk
Shane van Wyk

Reputation: 1900

Stop ServiceStack Metadata Auto Redirect

Since I have upgraded to the new ServiceStack 4.0.48 from a very old version, it automatically redirects me to the /metadata page. How do I disable that?

I have added the ServiceStack Application to host off an existing application, now I can't use my existing application because it keeps redirecting to /metadata.

I had a look online but can't really find anything, It never used to automatically redirect.

I need to go to example.com but it keeps redirecting me to example.com/metadata

Upvotes: 0

Views: 345

Answers (1)

mythz
mythz

Reputation: 143339

In order to display a homepage, it needs a default index page, e.g. default.cshtml or default.html. If there isn't a home page ServiceStack automatically redirects to the /metadata page so it has something to show. If you have a default document that isn't getting displayed, it maybe due to an Exception on StartUp resulting in incomplete configuration - you can check for Start up errors with the ?debug=requestinfo Debug Route.

Otherwise to redirect to a different route for the home page you can use:

SetConfig(new HostConfig {
    DefaultRedirectPath = "/alt-path"
});

Whilst the Metadata redirects can be changed with:

SetConfig(new HostConfig {
    MetadataRedirectPath = "/alt-path"
});

Upvotes: 4

Related Questions