@Override
    public boolean isRedirectAllowed(
            final HttpHost currentTarget,
            final HttpHost newTarget,
            final HttpRequest redirect,
            final HttpContext context) {

        // If authority (host + effective port) differs, strip sensitive headers
        if (!isSameAuthority(currentTarget, newTarget)) {
            for (final Iterator<Header> it = redirect.headerIterator(); it.hasNext(); ) {
                final Header header = it.next();
                if (header.isSensitive()
                        || header.getName().equalsIgnoreCase(HttpHeaders.AUTHORIZATION)
                        || header.getName().equalsIgnoreCase(HttpHeaders.COOKIE)) {
                    return false;
                }
            }
        }
        return true;
    }
Creates a new {@code DefaultRedirectStrategy} with the default
{@link DefaultSchemePortResolver#INSTANCE}.

@since 5.6
httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultRedirectStrategy.java