Ngrok v3 is deprecating tunnels
in the ngrok.yml
file in favour of endpoints
:
https://ngrok.com/docs/agent/config/v3/#endpoint-configurations
I have a tunnel configured like this:
tunnels:
mytunnel:
proto: http
addr: 3000
host_header: localhost
The host_header
is the important bit.
I have tried translating this in to an endpoint but cannot work out how to add the host header.
Without the host header it looks like:
endpoints:
- name: myendpoint
upstream:
url: 3000
This works but lacks the host header.
From the documentation, it looks like I want to use request_header.add
.
However, I cannot workout from the documentation where that should go in the config. Wherever I try to place it, I get errors along the lines of:
ERROR: Error reading configuration file 'ngrok/ngrok.yml':YAML parsing error: yaml: unmarshal errors:
ERROR: line 7: field request_header not found in type config.Endpoint
Can anyone guide me to the correct configuration here?
Yeah, this isn't very well documented. We're transitioning to configuring endpoints with traffic_policy
. So, until we fix our docs, I'll explain what you need to do here. To add a request header, you would configure an inbound
action of type: "add-headers"
. The config would look something like the following:
version: 3
endpoints:
- name: myendpoint
upstream:
url: 3000
traffic_policy:
inbound:
- actions:
- type: "add-headers"
config:
headers:
host: localhost