Commit 87f74bbb authored by David Stinemetze's avatar David Stinemetze Committed by Sascha Grossenbacher
Browse files

Issue #3065229 by WidgetsBurritos: Clarify redirect_domain precedence

parent 299131cd
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -28,6 +28,19 @@ function redirect_domain_help($route_name, RouteMatchInterface $route_match) {
      $output .= '<li>' . t('Request: example.com/redirect => Response: redirected.com/example-path') . '</li>';
      $output .= '<li>' . t('Request: foo.com/any-path => Response: bar.com') . '</li>';
      $output .= '</ul>';
      $output .= '<h5>' . t('Precedence') . '</h5>';
      $output .= t('Top-down precedence is used. This means the first matching redirect that is found will be taken. For example, assume these redirect rules:') . '</p>';
      $output .= '<ul>';
      $output .= '<li>' . t('foo.com/some/path => somedomain.com/path') . '</li>';
      $output .= '<li>' . t('foo.com/* => wildcardredirect.com') . '</li>';
      $output .= '<li>' . t('foo.com/other/path => otherdomain.com/path') . '</li>';
      $output .= '</ul>';
      $output .= '<p>' . t('The following redirects would actually occur:') . '</p>';
      $output .= '<ul>';
      $output .= '<li>' . t('foo.com/some/path => somedomain.com/path') . '</li>';
      $output .= '<li>' . t('foo.com/other/path => wildcardredirect.com') . '</li>';
      $output .= '</ul>';

      return $output;
  }
}
+17 −0
Original line number Diff line number Diff line
@@ -53,6 +53,20 @@ class DomainRedirectRequestSubscriberTest extends UnitTestCase {
              'destination' => 'redirected.com/redirect',
            ],
          ],
          'wildcardtest:com' => [
            [
              'sub_path' => '/some/path',
              'destination' => 'somedomain.com/path',
            ],
            [
              'sub_path' => '/*',
              'destination' => 'wildcardredirect.com',
            ],
            [
              'sub_path' => '/other/path',
              'destination' => 'otherdomain.com/path',
            ],
          ],
        ],
      ],
      'redirect.settings' => [
@@ -139,6 +153,9 @@ class DomainRedirectRequestSubscriberTest extends UnitTestCase {
    $datasets[] = ['http://nonexisting.com', NULL];
    $datasets[] = ['http://simpleexample.com/wrongpath', NULL];
    $datasets[] = ['http://foo.com/fixedredirect', 'http://bar.com/fixedredirect'];
    $datasets[] = ['http://wildcardtest.com/some/path', 'http://somedomain.com/path'];
    $datasets[] = ['http://wildcardtest.com/other/path', 'http://wildcardredirect.com'];
    $datasets[] = ['http://wildcardtest.com/does-not-exist', 'http://wildcardredirect.com'];
    return $datasets;
  }
}