Open brichardson1991 opened 5 years ago
Yep, the URL is not correct. Thanks for the report @brichardson1991. Looking into it now.
We'll need to look at this MakeFullUrlWithDomain
code, after stripping that out I now have a working UmbracoFlare in the backoffice. I wonder what's changed and what versions of Umbraco this has changed for. I'll bring it up to the team and get something pushed out soon.
In the meantime, if you'd like to fix it locally for your site I updated the following lines of code:
public List<string> GetUrlsForNode(IContent content, bool includeDescendants = false)
{
List<string> urls = new List<string>();
string url = UmbracoContext.Current.RoutingContext.UrlProvider.GetUrl(content.Id, true);
urls.AddRange(UrlHelper.MakeFullUrlWithDomain(url, RecursivelyGetParentsDomains(new List<string>(), content)));
urls.AddRange(UmbracoContext.Current.RoutingContext.UrlProvider.GetOtherUrls(content.Id));
if(includeDescendants)
{
foreach(IContent desc in content.Descendants())
{
urls.Add(UmbracoContext.Current.RoutingContext.UrlProvider.GetUrl(desc.Id, true));
urls.AddRange(UmbracoContext.Current.RoutingContext.UrlProvider.GetOtherUrls(desc.Id));
}
}
return urls;
}
And updated it to (from memory):
public List<string> GetUrlsForNode(IContent content, bool includeDescendants = false)
{
List<string> urls = new List<string>();
urls.Add(UmbracoContext.Current.RoutingContext.UrlProvider.GetUrl(content.Id, true));
urls.AddRange(UmbracoContext.Current.RoutingContext.UrlProvider.GetOtherUrls(content.Id));
if(includeDescendants)
{
foreach(IContent desc in content.Descendants())
{
urls.Add(UmbracoContext.Current.RoutingContext.UrlProvider.GetUrl(desc.Id, true));
urls.AddRange(UmbracoContext.Current.RoutingContext.UrlProvider.GetOtherUrls(desc.Id));
}
}
return urls;
}
This may not be the final solution of course. I suspect one of the many minor updates since 7.4 / 7.5 has normalized how URLs are coming back.
7.10.4 Whenever clearing the cache I get the following back in my logs
ERROR UmbracoFlare.ApiControllers.CloudflareApiController - Something went wrong getting the purge cache response back. The url that was used is https://api.cloudflare.com/client/v4/zones/zoneid/purge_cache. The json that was used is {"files":["test.domain.co.uk/https://test.domain.co.uk/"]}. The raw string value is {"files":["test.domain.co.uk/https://test.domain.co.uk/"]}