You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SitemapRepository tries to resolve the SiteDefinition using the url hostname ( See code fragment below). However the HostDefinition Name property is mapped to the url authority. When using a hostname with a port number, e.g. 'http://my.site:21806' no site definition will be resolved and a 404 will be returned. This did function correctly in earlier versions ( 3.1.1 ).
public SitemapData GetSitemapData(string requestUrl)
{
var url = new Url(requestUrl);
// contains the sitemap URL, for example en/sitemap.xml
var host = url.Path.TrimStart('/').ToLowerInvariant();
var siteDefinition = _siteDefinitionResolver.GetByHostname(url.Host, true, out _);
if (siteDefinition == null)
{
return null;
}
var sitemapData = GetAllSitemapData()?.Where(x =>
GetHostWithLanguage(x) == host &&
(x.SiteUrl == null || siteDefinition.Hosts.Any(h => h.Name == new Url(x.SiteUrl).Authority))).ToList();
if (sitemapData?.Count == 1)
{
return sitemapData.FirstOrDefault();
}
// Could happen that we found multiple sitemaps when for each host in the SiteDefinition a Sitemap is created.
// In that case, use the requestURL to get the correct SiteMapData
return sitemapData?.FirstOrDefault(x => new Url(x.SiteUrl).Authority == url.Authority);
}
public static HostDefinition Find(
this IEnumerable<HostDefinition> hosts,
string hostName,
bool fallbackToWildcard)
{
bool flag = HostDefinition.IsWildcardHost(hostName);
HostDefinition hostDefinition1 = (HostDefinition) null;
foreach (HostDefinition hostDefinition2 in hosts.Where<HostDefinition>((Func<HostDefinition, bool>) (h => h.Authority != null && h.Authority.Matches(hostName, fallbackToWildcard))))
{
if (flag || !hostDefinition2.IsWildcardHost())
return hostDefinition2;
if (fallbackToWildcard)
hostDefinition1 = hostDefinition2;
}
return hostDefinition1;
}
The text was updated successfully, but these errors were encountered:
The SitemapRepository tries to resolve the SiteDefinition using the url hostname ( See code fragment below). However the HostDefinition Name property is mapped to the url authority. When using a hostname with a port number, e.g. 'http://my.site:21806' no site definition will be resolved and a 404 will be returned. This did function correctly in earlier versions ( 3.1.1 ).
.Net Framework 4.7.2
Episerver.CMS 11.20.5
Episerver.Commerce 13.30
Geta.SEO.Sitemaps 4.0.0
Geta.SEO.Sitemaps.Commerce 4.0.0
The text was updated successfully, but these errors were encountered: