I am in a machine A, there is an middle machine(Jump Server) named B, and a 'outside' machine C. Since I can not connect C directly, but I can ssh login to B.
For now i will firstly ssh
login to B, then send a request from B, eg:
$ ssh myname@<ip_B> -p <port_B>
myname@<ip_B>'s password:
Last login: Tue Aug 7 10:14:21 2018 from ...
After I login to B I sent post using curl
.
[myname@<ip_B>]$ curl -X POST http://<ip_C>:<port_C>/<route> -F 'my_post_key=my_post_value'
curl
?You could use a tunnel, something like this:
$ ssh -N -L 8080:machine-C:80 machine-B
The option -L
will do a local port forwarding from port 8080 (machine-A) to port 80 in machine-C going through machine-B.
Then from machine-A:
$ curl -H "host: example.com" 0:8080
You may need to pass the host
header in case the machine-C is hosting multiple sites.
Once the tunnel is up, in postman you could use 127.0.0.1:8080
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With