{
  "slug": "k6-browser-context-proxy-option-02e783969b7a",
  "title": "k6 browser context proxy option",
  "tools": [
    "k6"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-06-30T08:56:09.000Z",
  "announced_at": "2026-06-30T08:56:09.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a k6 browser script needs to route a context’s traffic through a proxy, pass `proxy` to `browser.newContext` and provide `proxy.server`.",
    "examples": [
      "import { browser } from 'k6/browser';\n\nexport const options = {\n  scenarios: {\n    browser: {\n      executor: 'shared-iterations',\n      options: { browser: { type: 'chromium' } },\n    },\n  },\n};\n\nexport default async function () {\n  const context = await browser.newContext({\n    proxy: {\n      server: 'http://proxy.test:8080',\n      bypass: 'localhost,127.0.0.1',\n    },\n  });\n  const page = await context.newPage();\n  try {\n    await page.goto('https://test.k6.io/');\n  } finally {\n    await page.close();\n  }\n}"
    ],
    "gotchas": [
      "Version: v2.1.0",
      "options.proxy: Proxy settings for all pages in the context; when set, `server` is required.",
      "options.proxy.server (required): Proxy server URL, including scheme and port.",
      "options.proxy.bypass: Comma-separated hosts to connect to directly, bypassing the proxy.",
      "Prerequisite: The documented example configures the browser scenario with `type: 'chromium'`.",
      "`proxy.server` must be provided."
    ]
  },
  "why_it_matters": "Route a browser context's traffic through a proxy while running a k6 browser script.",
  "before": "The v2.1.0 release note says environment proxy variables affected only k6’s DevTools WebSocket connection; routing context traffic required a custom-built binary or another approach.",
  "sources": [
    "https://github.com/grafana/k6/releases/tag/v2.1.0",
    "https://grafana.com/docs/k6/latest/javascript-api/k6-browser/newcontext/"
  ],
  "rank": 0.97027,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-f5a2c73dc19919f0-3:gate",
    "evidence_hash": "0090b299045eea76f39a725a7b13f9daa28e12105abc5133dcf02903bfef7472"
  },
  "review": {
    "draft_hash": "deaf4d57efd35b90ca107e3945fc58fd56a866c14c072a65350dd7bb40618467",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.77 (>= 0.6 needed)."
  }
}
