Using ServerEvents in Javascript, i get some errors if i expose my ServerEvents Server to the internet, using a portforwarding in the router that forwards outside port 8180 to client port 80.
The url is temporary including the 8180 port. When firing up ServerEvents, i get these errors in Networktraffic:
event-heartbeat uses the wrong URL, where event-stream is using the right url. Is this something configurable?
ServiceStack uses the incoming Request URL to create its Absolute URL links which can be overridden for all resolved links by either hard-coding the BaseUrl with:
public override string GetBaseUrl(ServiceStack.Web.IRequest httpReq)
{
/// Url's are not parsed correctly with possible different port then ServiceStack normal BaseUrl
var userHostName = ((System.Net.HttpListenerRequest)httpReq.OriginalRequest).UserHostName;
var result = base.GetBaseUrl(httpReq);
if (result.Contains("https"))
return "https://{0}".Fmt(userHostName);
else
return "http://{0}".Fmt(userHostName);
}
Still, i would say something is off; all requests will work fine, except the ServerEvents Feature, also; Auth HtmlRedirect etc… url’s are ‘off’. Maybe i’m the one doing something weird here, but in my experience, more it systems wil forward ports to other ports then te base port in the website.
ServiceStack is only able to generate the Absolute URL from the incoming request url, if you’re using a Reverse proxy then the proxy normally does the url rewriting into the external url (e.g. links in HTML pages), but it’s likely it’s not modifying urls returned in JSON responses.