@Override
    public URI getLocationURI(
            final HttpRequest request,
            final HttpResponse response,
            final HttpContext context) throws HttpException {
        Args.notNull(request, "HTTP request");
        Args.notNull(response, "HTTP response");
        Args.notNull(context, "HTTP context");

        //get the location header to find out where to redirect to
        final Header locationHeader = response.getFirstHeader(HttpHeaders.LOCATION);
        if (locationHeader == null) {
            throw new HttpException("Redirect location is missing");
        }
        final String location = locationHeader.getValue();
        URI uri = createLocationURI(location);
        try {
            if (!uri.isAbsolute()) {
                // Resolve location URI
                uri = URIUtils.resolve(request.getUri(), uri);
            }
        } catch (final URISyntaxException ex) {
            throw new ProtocolException(ex.getMessage(), ex);
        }

        return uri;
    }
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