All Rammerhead configuration lives inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/binary-person/rammerhead/llms.txt
Use this file to discover all available pages before exploring further.
src/config.js. The file exports a single object whose properties control everything from which address the server binds to, to how sessions are stored and how JavaScript rewrites are cached. You rarely need to edit src/config.js directly — instead, create a config.js file in the project root and export only the properties you want to change. Rammerhead merges that file over the defaults automatically.
Override mechanism
At the bottom ofsrc/config.js, Rammerhead checks for a root-level config.js and merges it in:
src/config.js untouched — making git pull conflict-free — while maintaining your own settings:
The
DEVELOPMENT environment variable enables debug-level logging and an additional /garbageCollect endpoint. Set it with DEVELOPMENT=true node src/server.js or by placing DEVELOPMENT=true in a .env file at the project root (Rammerhead loads .env files automatically via dotenv-flow).Hosting
The local IP address the HTTP server binds to. Use
'0.0.0.0' to listen on all interfaces, which is required when accepting connections from outside the local machine.The main port the proxy listens on. All session creation, management endpoints, and proxied traffic flow through this port.
A second port used for cross-domain resource requests that hammerhead isolates to avoid CORS issues. Set to the same value as
port if you want to use a single port; Rammerhead handles the overlap correctly.Path to a directory of static files served at the root of the proxy. Set to
null to disable static file serving entirely.Enable multi-threaded mode using Node.js cluster. Defaults to
true on machines with more than one CPU core. When enabled, a master process distributes connections across worker processes using sticky sessions so that each session always lands on the same worker.Number of worker processes to spawn when
enableWorkers is true. Defaults to the number of logical CPU cores.TLS configuration. Set to For more details see the Node.js HTTPS docs.
null to serve plain HTTP. To enable HTTPS, pass an object with key and cert buffers — the same shape accepted by Node’s https.createServer:A function that receives the incoming Dynamic example (reads the
req object and returns an object describing how clients should construct proxy URLs. Use this when Rammerhead sits behind a reverse proxy and its public hostname or ports differ from bindingAddress/port.Default (hardcoded localhost):Host header, useful behind nginx or Cloudflare):Authentication
Password required to call
/newsession, /editsession, and /deletesession. Clients pass it as a pwd query parameter. Set to null to allow anyone to create sessions without a password.Sessions
When
false, Rammerhead synchronizes the proxied site’s localStorage with the session store so it persists across requests. Set to true if clients send very large localStorage payloads and memory usage becomes a concern.When
true, a session can only be used from the IP address that created it. This prevents session hijacking but breaks use cases where users legitimately change IP mid-session (e.g., mobile users switching between Wi-Fi and cellular).JS caching
Rammerhead rewrites all JavaScript that passes through it. The rewritten output is cached so identical scripts are not reprocessed on every request. Two cache backends are available.The JS rewrite cache instance. The default is a Disk cache (default, recommended for most deployments):
RammerheadJSFileCache backed by the cache-js/ directory with a 5 GB limit and 50,000 item cap.Memory cache (faster, limited to available RAM):Disk caching is not recommended on slow HDD storage. Use an SSD or switch to memory caching if disk I/O is a bottleneck.
HTTP/2
When
false, Rammerhead uses HTTP/2 for connections from the proxy to destination sites. Disabling HTTP/2 may reduce memory usage and connection errors, but can break sites that require an HTTP/2 handshake before upgrading to a WebSocket (such as web.whatsapp.com).Header rewriting
A list of request header names to remove before forwarding the request to the destination. Use this to strip headers added by a reverse proxy (such as Cloudflare) that would expose the proxy’s infrastructure:
A map of response header names to new values. Set a header to
null to delete it. Set it to a function to compute the new value from the original:Session store
ThefileCacheSessionConfig object configures RammerheadSessionFileCache, which serializes sessions to disk and manages their lifecycle.
Directory where session files are written. Each session is stored as a
.rhfsession file named by its session ID. The directory must exist before the server starts.Time in milliseconds a session stays in memory after its last use before being written to disk and evicted from the in-memory cache. Default is 20 minutes (1,200,000 ms).
How often in milliseconds the server checks for sessions that have exceeded
cacheTimeout and should be flushed to disk. Default is 10 minutes (600,000 ms).When
true, sessions that were created but never used (their lastUsed timestamp equals their createdAt timestamp) are deleted instead of being written to disk when evicted from memory.When
true, session files that fail JSON parsing (which can happen if Node.js exits abruptly while writing a session) are automatically deleted on load.Controls periodic deletion of old session files from disk. Set to
null to disable stale cleanup entirely. The default configuration is:staleTimeout— sessions not accessed within this window (in ms) are deleted. Set tonullto disable.maxToLive— sessions older than this (in ms) are deleted regardless of activity. Set tonullto disable.staleCheckInterval— how often (in ms) the stale cleanup runs.
Logging
Controls which log messages are emitted. Valid values from most to least verbose:
'debug', 'traffic', 'info', 'warn', 'error', and 'disabled' (suppresses all output). Setting a level emits messages at that level and all higher-priority levels.When the DEVELOPMENT environment variable is set, the default changes to 'debug'.A function that receives a log level string and returns the prefix prepended to every log line. Override to change the timestamp format or add custom fields:
Extracts the client IP from a request object. The default reads
req.socket.remoteAddress, which is correct when clients connect directly. When Rammerhead is behind a reverse proxy, use the forwarded header instead:Full example override
The followingconfig.js placed in the project root illustrates a typical production setup — listening on all interfaces, using HTTPS, with a custom password and Cloudflare header stripping: