diff --git a/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs b/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs index 1e8d69cd7..678ed7ec2 100644 --- a/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs +++ b/src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs @@ -27,7 +27,10 @@ public async Task Invoke(HttpContext httpContext) var upstreamQueryString = httpContext.Request.QueryString.ToString(); - var upstreamHost = httpContext.Request.Headers["Host"]; + var hostHeader = httpContext.Request.Headers["Host"].ToString(); + var upstreamHost = hostHeader.Contains(':') + ? hostHeader.Split(':')[0] + : hostHeader; Logger.LogDebug($"Upstream url path is {upstreamUrlPath}");