ComfyUI Node

HTTP HEAD Request

Check that an endpoint exists without downloading a byte of it

By wawahuy·Created about a year ago·Updated 11 months ago· 14
HTTP HEAD Request
  • session
  • auth
  • status_code
  • headers
  • content_length
  • content_type
urlhttps://api.example.com/data
headers{}
params{}
timeout30
verify_ssltrue
allow_redirectstrue
cookies{}
proxy_url

HEAD is the polite way to ask a server "is this here, and how big is it?" without it sending you the whole thing. HTTP HEAD Request is a small node for a small job, and honestly, in most ComfyUI workflows you'll never need it. But for the niche cases - pre-flight checks before an HTTPImageLoader or HTTPGet fetches a big asset, verifying an endpoint still responds, sniffing the response headers of an API you're reverse-engineering - it's exactly right, and it shares the pack's standard plumbing so there's nothing new to learn.

How it works

A HEAD request returns status and headers, no body. The node wraps requests.head() with the usual session/auth/header/proxy support, then does the extraction work for you so you don't have to parse headers by hand.

Required: just url. Optional: session, auth, headers, params, timeout, verify_ssl, allow_redirects, cookies, proxy_url - all the same inputs as the other method nodes, all behaving the same way.

Four outputs, and they're worth reading closely because they're different from the other method nodes:

  • status_code - 200 means it's there. 404 means it isn't. This is your go/no-go signal.
  • headers - the full response headers as a JSON string, if you need to dig into something specific.
  • content_length - pulled straight from the response header. This is the "how big is that file" answer before you download it.
  • content_type - what the server says it's serving. Handy for sanity-checking that a URL really points at an image before you point HTTPImageLoader at it.

Where you'd actually use it

A tiny "should I fetch this?" gate: HEAD the URL, check status_code is 2xx and content_type starts with image/, then let the loader proceed. You've avoided downloading a 500 MB file just to discover it 404'd or serves HTML. That's the whole use case, and it's a good one.

Install

ComfyUI Manager → search "ComfyUI-HTTP" → Install, restart. Manual:

cd ComfyUI/custom_nodes/
git clone https://github.com/wawahuy/ComfyUI-HTTP.git
cd ComfyUI-HTTP
pip install -r requirements.txt

Nothing to download beyond the node itself.

Where people get burned

On network failure this node returns status_code = 0 with empty content_length and content_type strings rather than erroring - same no-throw pattern as the rest of the pack, so branch on the status code, not on whether an output is empty. And don't expect a HEAD to be a reliable proxy for what a GET will return: plenty of servers send different headers for HEAD than they do for GET, so treat content_length as a hint, not a promise.

CategoryHTTP/Methods

Inputs (10)

NameTypeDefaultDescription
urlSTRINGhttps://api.example.com/data
sessionoptHTTP_SESSION
authoptHTTP_AUTH
headersoptSTRING{}
paramsoptSTRING{}
timeoutoptINT301–300
verify_ssloptBOOLEANtrue
allow_redirectsoptBOOLEANtrue
cookiesoptSTRING{}
proxy_urloptSTRING

Outputs (4)

NameTypeDescription
status_codeINT
headersSTRING
content_lengthSTRING
content_typeSTRING