Fix signal URL for virtual directories

Fixes #1525
This commit is contained in:
Sipke Schoorstra 2021-09-20 16:33:51 +02:00
parent 8cd82b5a3c
commit fd44667abc

View file

@ -18,7 +18,13 @@ namespace Elsa.Activities.Http.Services
if (baseUrl == null)
throw new Exception("There was no base URL configured, which means no absolute URL can be generated from outside the context of an HTTP request. Please make sure that `HttpActivityOptions` is configured correctly. The configuration key used in most Elsa samples is usually: \"Elsa:Server:BaseUrl\"");
return new Uri(baseUrl, relativePath);
// To not lose any base path information, we need to ensure that:
// - Base path ends with a slash.
// - Relative path does NOT start with a slash.
var baseUri = new Uri(baseUrl.ToString().TrimEnd('/') + '/');
relativePath = relativePath.TrimStart('/');
return new Uri(baseUri, relativePath);
}
}
}