apply patch to fix infinite loops redirects

https://www.drupal.org/node/1796596#comment-8506117
Merge branch 'infinite-loops'