Bugfix/invalid url generated by chain route

Fixes #4948
Closes #5688