justeat / openrasta-hosting-owin

OWIN host for OpenRasta
Other
1 stars 5 forks source link

BaseUri is currently hard coded in middleware #8

Closed tharris29 closed 2 years ago

tharris29 commented 10 years ago

In the middleware invoke the base uri is currently hardcoded. Should be able to get this from the owin context from the incoming request.

tharris29 commented 10 years ago

Partially fixed, still need to look at the relative path. Relative path is currently commented out

  public Uri ApplicationBaseUri
    {
        get
        {
            var request = _nativeContext.Request;

            string baseUri = "{0}://{1}{2}/".With(request.Uri.Scheme,
                                                 request.Uri.Host,
                                                  request.Uri.IsDefaultPort ? string.Empty : ":" + request.Uri.Port);
            //todo manage the relative path if needed?
            var appBaseUri = new Uri(baseUri, UriKind.Absolute);//, new Uri(_host.ApplicationVirtualPath, UriKind.Relative));
            return appBaseUri;
        }
    }