We have a "webapi" site built using servicestack and everything works great
Now browsing to the site brings up the ~/metadata page
Is there an option to show a custom stub page as in - pls visit the main site at www.abc.com
or better yet, redirect the browser to www.abc.com
In the EndpointHostConfig , you can set MetadataRedirectPath and DefaultRedirectPath. However, looking at the source code MetadataRedirectPath and DefaultRedirectPath both expect a relative url .
If you need more control or want to redirect to an outside site then you can intercept the entire request . So in your specific case you can do the following:
In AppHost configuration
SetConfig(new EndpointHostConfig
{
RawHttpHandlers =
{
httpReq => httpReq.PathInfo == "/metadata" ?
new RedirectHttpHandler { AbsoluteUrl = "http://www.abc.com" }
: null
},
});
Edit: Changed code to reflect mythz suggestion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.