Can you pass custom HTTP headers in aria2?

This article provides a straightforward guide on how to pass custom HTTP headers to a server using the aria2 command-line download utility. We will explore the specific command-line option required, look at practical examples for adding single or multiple headers, and explain how to format them correctly to avoid syntax errors.

The --header Option

Yes, it is entirely possible to pass custom HTTP headers using aria2. The utility provides a dedicated command-line option, --header, specifically for this purpose. This is particularly useful when you need to bypass basic anti-scraping measures, mimic specific web browsers, or pass authentication tokens like cookies and bearer tokens to a server.

Basic Syntax and Usage

To append a custom header to your request, you use the --header option followed by the header name and its value enclosed in quotes.

aria2c --header="Header-Name: Value" "URL"

Practical Examples

Here are some common scenarios where you might need to use custom headers with aria2:

aria2c --header="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)" "https://example.com/file.zip"
aria2c --header="Authorization: Bearer your_access_token_here" "https://example.com/secure-file.zip"
aria2c --header="X-Custom-Header: MyValue" --header="Accept-Language: en-US" "https://example.com/data.json"

Important Considerations