header-generator is a core component of the Apify Fingerprint Suite, a toolkit designed to generate realistic, browser-like HTTP headers for web scraping and anti-fingerprinting purposes. Currently at version 2.1.82, the package receives frequent, automated updates primarily for its underlying data models, ensuring the generated headers remain current and effective against sophisticated bot detection. While its standalone GitHub repository is marked as deprecated, the package itself is actively maintained and developed as an integral part of the larger fingerprint-suite project. It allows developers to programmatically create HTTP headers that mimic various browsers, operating systems, devices, and locales, helping scrapers blend in more effectively with legitimate user traffic. Its key differentiator is the focus on realism and configurability based on real-world browser data.
npm install header-generatorVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing HeaderGenerator with options, generating headers with global and specific constraints, and using predefined PRESETS.
Always consult the main `fingerprint-suite` repository for overarching architecture and updated guidelines regarding `header-generator`'s usage.
Store the result of `getHeaders()` if you need to reuse the same set of headers. Do not assume repeated calls will yield identical results without explicit caching.
Manually add request-specific headers to the generated object before sending an HTTP request. For example, `const fullHeaders = { ...generatedHeaders, Host: 'example.com', 'Content-Length': body.length };`Ensure the `httpVersion` option matches the actual HTTP version used by your client to avoid sending malformed or incorrect headers.
Ensure `header-generator` is listed in `dependencies` and installed (`npm install header-generator`). Use `import { HeaderGenerator } from 'header-generator';` for ESM/TypeScript projects. For older Node.js or CommonJS, `const { HeaderGenerator } = require('header-generator');`.Verify that `headerGenerator = new HeaderGenerator(...)` was called successfully before attempting to use `getHeaders()`.
Consult the `HeaderGeneratorOptions` interface and documentation to ensure all options passed are valid. Remove or correct any misspelled or unsupported options.
No dependency data recorded yet.