Skip to main content
Popular web servers such as MAMP and WAMP rely on a technique popularly referred to as ‘Virtual Hosting’ which means that they consult the HTTP request’s Host header to determine which of their multiple sites they should serve. To expose a site like this it is possible to ask ngrok to rewrite the Host header of all requests to match what your web server expects. You can do this with the add-headers Traffic Policy action (see: Rewriting the Host header) to pick which virtual host you want to target. For example, to route to your local site myapp.dev, save the following as traffic-policy.yml:
Then start the agent with that Traffic Policy:
To use the local address hostname instead, set host to localhost.