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. 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.

    Use proxyNetworkHosts for most local web servers and APIs. This is the easiest option and uses HTTP interception in Node and in the browser.

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

    If you need raw TCP connections to a local loopback port, use proxyNetworkPorts instead. This is experimental.

    endform.jsonc
    {
    "proxyNetworkPorts": [5432, 6379]
    }

    You can configure both at the same time if needed. You can read more about proxyNetworkHosts and proxyNetworkPorts in the endform config reference.

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