Umbraco-cms: UrlProvider GetUrl doesn't work in Umbraco 8.9.1

Created on 10 Dec 2020  路  9Comments  路  Source: umbraco/Umbraco-CMS

If you override the default Umbraco Url Provider with the logic described in this Document https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline-vpre_8_1 The GetUrl doesn't get updated with the url you provide.

Umbraco version

I am seeing this issue on Umbraco version: 8.9.1

Reproduction

Implement a sample like mentioned here https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline-vpre_8_1 Change porductPage alias to any alias you want and see when the url is updated in code below

var originalUrl = defaultUrlInfo.Text;
var customUrl = originalUrl + "fish/";
return new UrlInfo(customUrl, true,defaultUrlInfo.Culture);

The rendered url on the front-end is still the old url


_This item has been added to our backlog AB#9773_

statsprint-candidate staturegression typbug

Most helpful comment

Just came here to post the exact same issue! This is quite a big deal!

Exactly as @rsoeteman is saying: Just try out example on https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#example-1

Tested it on vanilla U8.9.1. It says 'Published but cannot be routed' in the backoffice. And 'too many redirects' on the frontend.

All 9 comments

Just came here to post the exact same issue! This is quite a big deal!

Exactly as @rsoeteman is saying: Just try out example on https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#example-1

Tested it on vanilla U8.9.1. It says 'Published but cannot be routed' in the backoffice. And 'too many redirects' on the frontend.

I can confirm this. A IUrlProvider that works perfectly on 8.4.1 is crashing my 8.9 installation.

Yikes, that sounds like a regression, we'll have a look!

Does anyone have any idea where this regression comes from based on code changes from these versions?

I'm trying this out with the latest code in v8/dev

  • the front-end renders the custom URL
  • the back office displays Published but cannot be routed message - that is because there is no associated inbound handler which is expected (I would think that is the same behavior on all versions)

@Shazwazza I had a stab at finding out what is causing this when I first noticed this one. At our side I was calling the url property on a IPublishedContent which crashed my site (I suspect a infinite loop somewhere). I had to change the way I built up the url to get it working.

Will try to dive deeper during my holidays.

Dave

@Shazwazza I tried example (from documentation) on new clean 8.10 install.

  • Frontend (Main Menu) renders Custom URL fine
  • Backoffice is indeed the cannot be routed message (if that is default behaviour, then so be it)
  • When accessing the Custom URL I receive a 404 not found.

I assumed that if I only changed the Url, like in the doc example (simple addition to the url), I did not need to implement custom contentfinder for example. But maybe I'm wrong... In your testcase is your custom Url accessible? Or do I always need a contentfinder in combination with DefaultUrlProvider?

Thanks for looking in to this!
Arjan

Hi All,

I'm not really sure this is an issue then unless someone can confirm there is an actual regression?

Based on my (very quick) tests and @woldringarjan tests:

Frontend (Main Menu) renders Custom URL fine

OK

Backoffice is indeed the cannot be routed message (if that is default behaviour, then so be it)

A UrlProvider is "outbound" routing only, all this does is generate URLs for an item, this does not do "inbound" routing. In the back office you'll get this error because it tests whether this URL can be "inbound" routed and if it can't this message is shown.

When accessing the Custom URL I receive a 404 not found.

As above this is expected because a UrlProvider doesn't do "inbound" routing.

If you want to have a custom URL work for inbound routing you need to make an IContentFinder, or have a custom route that handles the URL that is generated by your UrlProvider.

My concern is with @dawoe comment:

I can confirm this. A IUrlProvider that works perfectly on 8.4.1 is crashing my 8.9 installation.

That sounds like a regression of some sort but I don't know how to replicate.

Was this page helpful?
0 / 5 - 0 ratings