Skip to content

Commit cc0b9b8

Browse files
grssmnnraman-m
andauthored
Ignore port when using UpstreamHost option (#1505)
* Ignore port when using UpstreamHost option * Update src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs --------- Co-authored-by: Raman Maksimchuk <[email protected]>
1 parent f8eb5e1 commit cc0b9b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Ocelot/DownstreamRouteFinder/Middleware/DownstreamRouteFinderMiddleware.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ public async Task Invoke(HttpContext httpContext)
2727

2828
var upstreamQueryString = httpContext.Request.QueryString.ToString();
2929

30-
var upstreamHost = httpContext.Request.Headers["Host"];
30+
var hostHeader = httpContext.Request.Headers["Host"].ToString();
31+
var upstreamHost = hostHeader.Contains(':')
32+
? hostHeader.Split(':')[0]
33+
: hostHeader;
3134

3235
Logger.LogDebug($"Upstream url path is {upstreamUrlPath}");
3336

0 commit comments

Comments
 (0)