Doug Schmidt - 300 - Mar 11, 2014

In SSv4, hosts with custom paths seem to have a bug in how the default redirect path to the metadata page is composed.

For a site hosted at {root}, with a {customPath}, when the {root}/{customPath} page is requested, SSv3 correctly redirects to {root}/{customPath}/metadata.

In SSv4, the redirect URL is {customPath}/{root}/metadata, which borks.

Looking at the code, I can’t quite find where the redirect URL is composed. Any ideas?

Not sure what you mean by: {customPath}/{root}/metadata

What’s an example url of what it is vs what it should be? 

Wayne Brantley:

+Doug Schmidt I have a similar problem with this. Mine shows up when I use swagger and is around hosting the site somewhere other than root. I worked with +Demis Bellot on it quite a bit and we never solved (basically because it was on me to try to create a repo for him).   Here is the repo site, if you want to modify this so it breaks for your situation?   https://github.com/ServiceStack/Templates/tree/master/src/Mvc4.VirtualPath 

Doug Schmidt:

For my deployment:
{root} = “AQUARIUS”
{customPath} = "apps/v1"

http://localhost/AQUARIUS/apps/v1 redirects correctly to http://localhost/AQUARIUS/apps/v1/metadata using SSv3, but incorrectly to http://localhost/apps/v1/AQUARIUS/metadata using SSv4.

By {root} do you mean that “AQUARIUS” is the ServiceStack root HandlerPath? and “apps/v1” the custom route for a service? 

Also there is some configuration where you want to strip the virtual path, can you see this helps:
SetConfig(new HostConfig { StripApplicationVirtualPath = true }) 

Doug Schmidt:

“AQUARIUS” is the root path of the ASP.NET app, whose Web.config contains a top-level  <location path=“apps/v1”> node to set the ServiceStack root HandlerPath.

ok so “AQUARIUS” is the ASP.NET VirtualPath and “apps/v1” is the ServiceStack handler path. Can you see if  StripApplicationVirtualPath = true helps?

Doug Schmidt:

Setting StripApplicationVirtualPath = true has no effect.

Hi Doug,

Can you try again using the version on MyGet: 
https://github.com/ServiceStack/ServiceStack/wiki/MyGet

Doug Schmidt:

Yep. The code fix in MyGet works.