Closed NunoOlliveira closed 1 year ago
Have you find any solution for this ? I am having issue with this, port number is getting added after virtual directory and getting
A potentially dangerous Request.Path value was detected from the client (:).
Yes, we have changed 2 methods on the src\Ocelot\Request\Middleware\DownstreamRequest.cs file:
public HttpRequestMessage ToHttpRequestMessage()
{
Uri uri = new Uri(new UriBuilder() { Host = Host, Scheme = Scheme }.ToString());
UriBuilder uriBuilder = new UriBuilder
{
Host = uri.Host,
Path = (!string.IsNullOrEmpty(uri.AbsolutePath) && uri.AbsolutePath.Length > 3) ? $"{uri.AbsolutePath[1..^1]}{AbsolutePath}" : AbsolutePath,
Query = RemoveLeadingQuestionMark(Query),
Scheme = Scheme,
Port = Port,
};
_request.RequestUri = uriBuilder.Uri;
_request.Method = new HttpMethod(Method);
return _request;
}
and
public string ToUri()
{
Uri uri = new Uri(new UriBuilder() { Host = Host, Scheme = Scheme }.ToString());
UriBuilder uriBuilder = new UriBuilder
{
Host = uri.Host,
Path = (!string.IsNullOrEmpty(uri.AbsolutePath) && uri.AbsolutePath.Length > 3) ? $"{uri.AbsolutePath[1..^1]}{AbsolutePath}" : AbsolutePath,
Query = RemoveLeadingQuestionMark(Query),
Scheme = Scheme,
Port = Port,
};
return uriBuilder.Uri.AbsoluteUri;
}
Hello, and thank you for this awesome project. I would like to know if there is any chance for supporting IIS virtual directories in a load balancing environment.
If you specify the virtual directory path in the downstream host, it will become an invalid path: Example:
The URL will become
http://localhost/MyVirtualDirectory:80
instead of thehttp://localhost:80/MyVirtualDirectory
.Is this correct or am I missing something in the configuration file.
Best Regards.