Can I send a curl command to a specific worker?

#1

For example, I’d like a worker to handle my curl to import api.

0 Likes

#2

Workers are not accessible outside of the VPC, so it is not possible. Tunneling will probably work but you will be proxying (streaming) the import through one of the masters.

0 Likes

#3

Can you explain more about how I could tunnel the request?

0 Likes

#4

Set an HTTP request header X-Tunnel-To with the hostname of the worker as its value.

Update: See @garnaiz’s post below for more specific details on the “hostname” I mentioned above.

0 Likes

#5

You need to use the C3 nodeId and the port specification in the X-Tunnel-To http header. For example in dev-podz there is node (from Cluster.hosts()) dev-podz-app-w-001.dev-01-usw2.internal which I want to tunnel to, in curl I will specify the X-Tunnel-To as dev-podz-app-w-001.dev-01-usw2.internal:8080.

3 Likes

#6

You can even tunnel to a specific tenant/tag in your target server using those headers:

X-Tunnel-To:  target-server
X-Tunnel-Tenant: target-tenant
X-Tunnel-Tag: target-tag

Furthermore, your control a timeout for an established tunnel (default is 60s)

X-Tunnel-Timeout-Secs: 120
1 Like

#7

Thanks, everyone! It’s working wonderfully.

0 Likes