U4-9511 - Redirects Aren't Created When Renaming Content Nodes

Created by Nicholas Westby 09 Feb 2017, 22:32:56 Updated by Nathan Skidmore 29 Sep 2017, 14:53:29

Some details here: https://our.umbraco.org/forum/using-umbraco-and-getting-started/83873-built-in-redirect-dashboard-not-working

The short version is that I can't get any redirects to be created (e.g., when renaming or moving content nodes).

I have tried all the common stuff I can think of, such as confirming there are no remnants of 301 URL Tracker, emptying caches, rebuilding, changing configuration, temporarily disabling custom content finders and URL providers, and so on.

Latest version of Umbraco (7.5.9).

Comments

Nicholas Westby 10 Feb 2017, 02:25:46

This seems to work on a clean Umbraco install. I'm not sure what the issue is in my case. Could be something to do with the configuration (e.g., multitenant site with different homepages for different domains, or removal of trailing slashes).


Jason Prothero 10 Feb 2017, 18:17:04

Also getting the same issue on a site upgraded from 7.2.8 to 7.5.8. I have got it working on a clean install as well.


Nicholas Westby 10 Feb 2017, 18:29:28

@Prothero This is also on a site that was upgraded a number of times. It was something like 7.4.3 > 7.5.4 > 7.5.6 > 7.5.9.


Jason Prothero 10 Feb 2017, 18:54:58

When I debug with the source, I'm getting a return on this line:

https://github.com/umbraco/Umbraco-CMS/blob/release-7.5.8/src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs#L245

Trying to figure out why this thinks I'm a "SlaveServer" now. I don't have a Load Balanced setup on this site (distributedCall enable="false" in umbracoSettings.config).


Jason Prothero 10 Feb 2017, 19:02:45

OK, after debugging and saving a few times, now the "IsSlaveServer" is returning as false and its creating the redirects now. Strange. I'll try a few more tests.


Jason Prothero 10 Feb 2017, 19:07:11

Yep, I created a new content page, renamed it, and now the ServerRole is ServerRole.Unknown instead of ServerRole.Single (what is was when it worked). Thus, the redirect was not created.

Unsure how or why that is changing.


Nicholas Westby 10 Feb 2017, 19:12:51

@Prothero Interesting! That sort of makes sense (wouldn't want the slave servers modifying the database, I suppose).

In my case, I'm working with a team of developers, and there is also a development server so PM's and content editors can interact with the site while it is in development. We are all using the same database. Due to flexible load balancing, I suppose one of the servers could be getting marked as the "master" server and the others as the "slave" servers.

I wonder if there is a way to bypass this to force every server to be the "master" server.


Nicholas Westby 10 Feb 2017, 19:19:23

It seems that a master server can be forced with a bit of startup code: https://our.umbraco.org/documentation/getting-started/setup/server-setup/load-balancing/flexible-advanced#explicit-master-scheduling-server

However, I'm wondering if there is a way to simply disable load balancing entirely using just Umbraco's built-in configuration.


Jason Prothero 10 Feb 2017, 20:58:31

Good find! I hadn't seen that before. That's a good workaround if this is an issue that is difficult to fix.

I'll try it and see if it fixes it consistently.


Jason Prothero 10 Feb 2017, 22:46:50

Explicitly setting the site as the master with this method appears to have fixed the inconsistency. I'll continue to monitor it. However, I think this is still an issue that should be addressed.


Nicholas Westby 13 Feb 2017, 16:12:10

Agreed, it should be addressed. If you can change content, it seems like you should also be able to create redirects.


Sebastiaan Janssen 17 Feb 2017, 07:35:10

If you connect with multiple Umbraco instances to the same database, Umbraco's flexible load balancing scenario kicks in. https://our.umbraco.org/Documentation/Getting-Started/Setup/Server-Setup/Load-Balancing/flexible

So if a redirect is not created for one of your team, it's because Umbraco thinks the Umbraco instance making the update is a slave server, not the master.

You can make Umbraco have it's old behavior like it always used to be and tell it: "pretend I don't care about proper cache invalidation on all machines that I'm connected to". In order to do that, add this key to your web.config file: <add key="umbracoDisableElectionForSingleServer" value="true" />

The key name is a little weird, it means: hey Umbraco, I am a single server, do not do master election (https://our.umbraco.org/Documentation/Getting-Started/Setup/Server-Setup/Load-Balancing/flexible).

If you set that key (on all Umbraco instances connecting to the database) then Umbraco will behave like it did before 7.3.0.

This means that whenever a colleague updates a document type, you might not immediately see it, whenever they update a macro - you might not immediately see it, when they publish a document, your umbraco.config and runtime cache is not updated, a collegue uploads a media item, it's a broken image for everyone else, etc. etc. All the problems that have always existed in Umbraco and annoyed developers. :-) (I'm pretty sure that right-click on the CONTENT section -> Republish entire site exists for that reason!) These problems are one of the reasons why Umbraco cloud uses 1 database per developer by default.

As for:

Agreed, it should be addressed. If you can change content, it seems like you should also be able to create redirects.

Agreed. We'll make older methods behave. One day. :)


Pete Duncanson 17 Feb 2017, 17:19:01

So is this an issue with older content editing methods or the new 301 stuff that was added in June (post 7.3 and load balancing mods)? Some pointers of where to look and next action would be handy for those wanting to "have a go" assuming it is something that you can indeed have a go at :)


Jason Prothero 17 Feb 2017, 17:57:14

@sebastiaan I'll test the today and report back


Jason Prothero 18 Feb 2017, 00:18:30

This app setting also appears to work as a fix to the issue in my testing. Thanks @sebastiaan!


Nicholas Westby 21 Feb 2017, 02:46:38

Agreed. We'll make older methods behave. One day. :)

Not sure I follow. The redirect stuff is very new (introduced in 7.5.x, if I'm not mistaken). I second what Pete said; some clarity would help in getting a pull request made (whether it be by the core team or by the community).


Pete Duncanson 22 Mar 2017, 16:55:32

@sebastiaan any pointers on this one?


Nathan Skidmore 29 Sep 2017, 14:53:17

I have just come across this issue in a load balanced environment using Umbraco 7.6.5. If we rename something the redirects are not created. Works perfectly in our test environment which is not load balanced. I can see that this is the suggested solution https://our.umbraco.org/documentation/getting-started/setup/server-setup/load-balancing/flexible-advanced#explicit-master-scheduling-server. I can't understand why this wouldn't be included in the core and manageable by config settings? @sebastiaan is there any plan to do this in the future? Thanks


Priority: Normal

Type: Bug

State: Submitted

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.5.9, 7.6.5

Due in version:

Sprint:

Story Points:

Cycle: