Skip to content

Proxy traffic via your local network

Servers that you want to test against that are either running locally or within a private network are not automatically exposed to the internet. These servers are not reachable by default from the remotely running Playwright instances. Trying to reach them without this extra setup, would likely result in connection errors in your tests.

When this happens, we need a method of shuttling traffic between the remote runners and the servers running on your local network.

A diagram of the traffic from the remote runners through your CLI to your local server.

Endform has the ability to connect the remote Playwright runners to the servers on your local network via direct, hole-punched, encrypted, peer-to-peer connections. We can do this by utilizing the iroh network.

  1. In order for traffic to be proxied, we need to install the extra endform-proxy-network package in the same place as you installed the main endform CLI.

    Terminal window
    npm install --save-dev endform-proxy-network
  2. If you want to run your local server as a playwright webServer then you’re done! Leave your web server configuration as is, and we will automatically proxy the traffic to your local server.

    If you’re running a server outside of playwright - that’s fine. You can tell endform which traffic to proxy by using a endform.jsonc file.

    endform.jsonc
    {
    "proxyNetworkHosts": [
    "<loopback>",
    "*.my-special-domain.com"
    ]
    }

    You can read more about the proxyNetworkHosts configuration in the endform config reference.

  3. That’s it! You can now run your tests as normal, and the traffic will be proxied via the cli to your target server.