From fc73178769b58d0cae3378a5a83dd434aa3f7851 Mon Sep 17 00:00:00 2001 From: Andrey Ushakov Date: Sat, 7 Mar 2020 18:31:38 +0300 Subject: [PATCH] Use hostname with prefix in sitemap --- core/Piranha.AspNetCore/SitemapMiddleware.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/Piranha.AspNetCore/SitemapMiddleware.cs b/core/Piranha.AspNetCore/SitemapMiddleware.cs index 09f7785c5..e38bed94a 100644 --- a/core/Piranha.AspNetCore/SitemapMiddleware.cs +++ b/core/Piranha.AspNetCore/SitemapMiddleware.cs @@ -47,10 +47,8 @@ public override async Task Invoke(HttpContext context, IApi api, IApplicationSer if (useSitemapRouting && !IsHandled(context) && !context.Request.Path.Value.StartsWith("/manager/assets/")) { var url = context.Request.Path.HasValue ? context.Request.Path.Value : ""; - var host = context.Request.Host.Host; var scheme = context.Request.Scheme; - var port = context.Request.Host.Port; - var baseUrl = scheme + "://" + host + (port.HasValue ? $":{port}" : ""); + var baseUrl = scheme + "://" + service.Hostname; if (url.ToLower() == "/sitemap.xml") {