The HTTP protocol object is the central place to define behavior that applies across all HTTP requests in a scenario. Rather than repeating connection settings, authentication credentials, or common headers on every individual request, you configure them once on the protocol and attach it to your scenario setup. Gatling supports a comprehensive range of HTTP behaviors — including caching, cookies, redirects, resource inference, and TLS — matching what modern browsers do, while operating purely at the HTTP protocol level without executing JavaScript or CSS.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gatling/gatling.io-doc/llms.txt
Use this file to discover all available pages before exploring further.
Bootstrapping
Every Gatling HTTP simulation starts by creating a protocol builder via thehttp object and passing it to setUp. This wires the protocol settings to the scenario’s virtual users.
HTTP Engine
warmUp
The Java/NIO engine incurs a startup overhead on the very first request. To compensate, Gatling automatically sends a warm-up request to https://gatling.io. You can change the warm-up URL or disable it entirely.
maxConnectionsPerHost
To mimic real browsers, Gatling can open multiple concurrent connections per virtual user when fetching resources over HTTP/1.1. The default cap is 6 connections per remote host per virtual user.
shareConnections
By default, every virtual user has its own connection pool and SSLContext, which accurately simulates browser-based internet traffic. If you are simulating server-to-server traffic where a single long-lived connection pool is shared across all clients, use shareConnections.
enableHttp2
Enable HTTP/2 support via ALPN negotiation. When enabled, Gatling attempts to connect using HTTP/2 and falls back to HTTP/1 automatically if the remote does not support it. HTTP/2 Push is not supported.
Request Generation
baseUrl
Setting a base URL prepends it to every relative URL in the scenario. Absolute URLs (those starting with http) are left unchanged.
baseUrls
To distribute load across multiple servers (e.g., bypassing a load balancer), provide a list of base URLs. Each virtual user is assigned one URL from the list in a round-robin fashion at startup.
disableAutoReferer
By default, Gatling automatically computes the Referer header from the request history. You can disable this behavior.
disableCaching
Gatling caches responses based on Expires, Cache-Control, Last-Modified, and ETag headers. You can disable this feature entirely.
disableUrlEncoding
By default, Gatling URL-encodes query parameters. If your URLs are already properly encoded and you want to avoid the overhead, you can disable this.
silentUri
Silent requests are excluded from reports and don’t influence error triggers such as tryMax or exitHereIfFailed. Their response times are still counted in group times. Use regex patterns to silence CDN or static asset requests at the protocol level.
Headers
Default Headers
Apply one or more HTTP headers to every request in the scenario. Values can be static strings, Gatling EL expressions, or functions.Built-in Header Shortcuts
Gatling provides named methods for the most common request headers, all accepting static, EL string, or function values.Authentication
Request Signing
You can supply a signing function that runs after Gatling builds the request and before it is sent. A common use case is computing a checksum header. A built-in for OAuth1 is also provided.Basic Auth and Digest Auth
Set HTTP authentication globally so all requests use the same credentials. Both static values and dynamic Gatling EL expressions are supported.Response Handling
Redirect Configuration
Gatling follows 301, 302, 303, 307, and 308 redirects automatically and caps redirect chains at 20 by default. You can disable redirect following, adjust the limit, or customize how redirect request names are generated.Resource Inference
Gatling can parse HTML responses and automatically fetch embedded resources in parallel, mimicking browser behavior. Supported tags include<script>, <base>, <link>, <bgsound>, <frame>, <iframe>, <img>, <input>, <body>, <applet>, <embed>, and <object>, as well as CSS @import directives.
Proxy Configuration
Route all HTTP requests through a proxy. You can supply credentials for authenticated proxies and bypass the proxy for specific hosts withnoProxyFor.
- HTTP Proxy
- HTTPS Proxy
- SOCKS4 Proxy
- SOCKS5 Proxy
DNS Resolution
JDK Blocking Resolver (default)
Gatling uses Java’s DNS name resolution by default, with a 30-second TTL on OpenJDK. For multiple DNS records (A records), Gatling shuffles them to emulate DNS round-robin behavior. The TTL can be tuned via thenetworkaddress.cache.ttl security property.
asyncNameResolution
Switch to Gatling’s own non-blocking async DNS resolver. You can also force specific DNS server addresses and opt into per-virtual-user DNS caches.
hostNameAliases
Define hostname aliases programmatically without modifying /etc/hosts.
Local Addresses
When your load generator has multiple IP addresses (via IP aliasing oriproute2), you can bind sockets to specific local addresses. Each virtual user is assigned one address in a round-robin fashion.
Per-User Key Manager
By default, Gatling uses theKeyManagerFactory from gatling.conf or the JVM default. For mutual TLS scenarios where each virtual user needs different certificates, you can supply a factory function keyed on the virtual user ID.
perUserKeyManagerFactory is not supported in the JavaScript/TypeScript SDK.