epi052/feroxbuster · error

Invalid request: Missing Host header and request line URI…

Error message

Invalid request: Missing Host header and request line URI isn't a full URL

What it means

Thrown by parse_request_file when no Host header was found and the request-line URI is a relative path, so a full target URL cannot be constructed. The library needs scheme://host/path to send the request and adds the URL to the scan scope.

Solutions

  1. Add a 'Host: example.com' header to the request file
  2. Or pass a full target URL via --url/-u so target_url is not empty
  3. Or make the request-line URI an absolute URL: 'GET https://example.com/path HTTP/1.1'

Example fix

// before
"GET /api HTTP/1.1\nAccept: */*"
// after
"GET /api HTTP/1.1\nHost: example.com\nAccept: */*"
Defensive patterns

Strategy: validation

Validate before calling

fn request_is_resolvable(raw: &str) -> Result<(), String> {
    let head = raw.lines().take_while(|l| !l.is_empty());
    let has_host = head.any(|l| l.to_ascii_lowercase().starts_with("host:"));
    let line = raw.lines().next().unwrap_or("");
    let uri = line.split_whitespace().nth(1).unwrap_or("");
    let absolute = uri.starts_with("http://") || uri.starts_with("https://");
    if has_host || absolute { Ok(()) } else {
        Err("need a Host header or absolute URI in the request line".into())
    }
}

Prevention

When it happens

Trigger: A request file with a relative URI like 'GET /api HTTP/1.1' but missing the 'Host:' header, and no --url flag providing a target; config.target_url remains empty after scanning head parts for a host.

Common situations: Users stripping the Host header when hand-crafting requests; using HTTP/2-style absolute-less requests in a raw HTTP/1.1 file; forgetting that the tool needs an absolute target when the request file lacks one.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


AI-assisted analysis of epi052/feroxbuster@1f595dab5c (2026-09-13). Data as JSON: /api/errors/1b30b050dbaa7522. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:594

        });

        url.set_query(None);
        url.set_fragment(None);

        config.target_url = url.to_string();
        config.scope.push(url);
    } else {
        // uri in request line is not a valid URL, so it's most likely a path/relative url
        // we need to combine it with the host header
        for (key, value) in &config.headers {
            if key.to_lowercase() == "host" {
                config.target_url = format!("{}://{value}{uri}", config.protocol);
                break;
            }
        }

        if config.target_url.is_empty() {
            bail!("Invalid request: Missing Host header and request line URI isn't a full URL");
        }

        if let Ok(url) = parse_url_with_raw_path(&config.target_url) {
            config.scope.push(url);
        } else {
            bail!(
                "Invalid request: Could not parse target URL {}",
                config.target_url
            );
        }

        // need to parse queries from the uri, if any are present
        let mut uri_parts = uri.splitn(2, '?');

        // skip the path
        uri_parts.next();

        if let Some(queries) = uri_parts.next() {

View on GitHub (pinned to 1f595dab5c)