redirect_validation_result

in lib/crawler/url_validator/url_request_check_concern.rb [101:149]


    def redirect_validation_result(details) 
      location = url_crawl_result.location

      
      unless location
        return validation_fail(:url_request, <<~MESSAGE, details)
          The web server at 
          that had no Location header. This type of response is not supported by the crawler.
        MESSAGE
      end

      
      details = details.merge(location: location.to_s)

      
      if url.domain_name == location.domain_name
        return validation_ok(:url_request, <<~MESSAGE, details)
          The web server at 
          redirection when crawling pages, but you need to make sure the destination URL
          is allowed by the crawl rules configured for this domain.
        MESSAGE
      end

      
      unless @crawl_config
        return validation_fail(:url_request, <<~MESSAGE, details)
          The web server at 
          If you want to crawl this site, please use 
        MESSAGE
      end

      
      if crawler_api_config.domain_allowlist.include?(location.domain)
        return validation_ok(:url_request, <<~MESSAGE, details)
          The web server at 
          Since 
          this redirection when crawling pages, but you need to make sure the destination
          URL is allowed by the crawl rules configured for this domain.
        MESSAGE
      end

      
      validation_fail(:url_request, <<~MESSAGE, details)
        The web server at 
        If you want to crawl this site, please configure 
        as one of the domains.
      MESSAGE
    end