You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何通过Fiddler捕获gatling.io的HTTPS/WSS请求?

Debugging Gatling Load Test Scripts with Fiddler

Great call using Fiddler for debugging—it’s way more intuitive to inspect request/response details than digging through console logs! Here’s how to route your Gatling traffic through Fiddler step by step:

1. Configure Gatling to Use Fiddler as a Proxy

Gatling’s HTTP client needs explicit proxy settings to send traffic through Fiddler. Add this to your script’s HTTP protocol definition:

val httpProtocol = http
  .baseUrl("https://your-target-server.com") // Replace with your actual target URL
  .proxy(Proxy("localhost", 8888).httpsPort(8888))
  • Fiddler uses port 8888 by default—use this for both HTTP and HTTPS traffic, since Fiddler handles HTTPS decryption automatically once set up.

2. Enable HTTPS Decryption in Fiddler

If your test sends HTTPS requests (which most modern apps do), you need Fiddler to decrypt traffic so you can view raw content:

  • Open Fiddler, go to Tools > Options > HTTPS
  • Check the box for "Decrypt HTTPS traffic"
  • Follow the prompts to install Fiddler’s root certificate (this is safe—it’s a local certificate only used to intercept traffic on your machine)

3. Fix SSL Trust Issues (If Encountered)

Sometimes Gatling’s JVM won’t trust Fiddler’s certificate, leading to SSL errors. If this happens:

  • Locate Fiddler’s root certificate (usually Documents/Fiddler2/FiddlerRoot.cer on Windows, or ~/Library/Application Support/FiddlerCore/FiddlerRoot.cer on Mac)
  • Add a JVM argument when running Gatling to trust this certificate:
    -Djavax.net.ssl.trustStore=/path/to/FiddlerRoot.cer
    
    Alternatively, import the certificate into your JVM’s default cacerts store for persistent trust across all Gatling runs.

4. Test and Validate

  • Make sure Fiddler is running before starting your Gatling test
  • Run your script, then check Fiddler’s session list—you’ll see all requests from Gatling appear here
  • Click any session to inspect request headers, payloads, response codes, and body content—perfect for verifying your script sends the correct data!

Quick Tips

  • Remove the proxy configuration from your script when running production load tests—routing traffic through Fiddler adds latency and will bottleneck your results
  • If you don’t see traffic in Fiddler, double-check that Gatling’s proxy port matches Fiddler’s configured port (confirm in Tools > Options > Connections)

内容的提问来源于stack exchange,提问作者CamHart

火山引擎 最新活动