Uri Hendler - 22 - Jan 6, 2015

I have a problem with the routes on the ServerEventsFeature.

My app is configured with:
SetConfig(new HostConfig
WebHostUrl = “http://mydomain.test”,
HandlerFactoryPath = “api”

If I send a request to http://mydomain.test/api/event-stream, I get back:
id: 1
data: cmd.onConnect {“userId”:"-2",“displayName”:“user2”,“profileUrl”:"",“id”:“JVjUcHYjGHGlhDToOHAQ”,“unRegisterUrl”:“http://mydomain.test/event-unregister?id=JVjUcHYjGHGlhDToOHAQ”,“heartbeatUrl”:“http://mydomain.test/event-heartbeat?id=JVjUcHYjGHGlhDToOHAQ”,“heartbeatIntervalMs”:“10000”,“idleTimeoutMs”:“30000”}

The unRegisterUrl and heartbeatUrl are generated using ResolveAbsoluteUrl, which does not include the HandlerFactoryPath.

Is this the correct behaviour? If yes, how do I get those url’s to be consistent?

What version of SS are you running? You can get a consistent base url by specifying Config.WebHostUrl or by overriding AppHost.ResolveAbsoluteUrl - BTW your Config.WebHostUrl should include the full url, e.g http://mydomain.text/api

Uri Hendler:

I’m running 4.0.35.

If I set the full WebHostUrl in the config (http://mydomain.test/api), it works correctly.

However, in that case, the operations metadata returned by /api/metadata is not correct (the “/api” is doubled up).
e.g. http://mydomain.test/api/api/json/metadata?op=ActivityRequest

The Postman metadata is correct though.

ok the correct url is the full BaseUrl inc. “…/api”, I’ve just resolved the absolute url in metadata pages this commit: https://github.com/ServiceStack/ServiceStack/commits (was using old url resolution behavior). 
Will let you know when it’s finished passing thru CI and gets deployed on MyGet.

FYI the Config.WebHostUrl url fix for metadata pages is now on MyGet: https://github.com/ServiceStack/ServiceStack/wiki/MyGet

Uri Hendler:

Great service, as always.