Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curl through an intermediate server

Tags:

curl

tunneling

I need to send PUT/GET/POST request with curl through a custom port from client1 to server2. However, server2 only accepts these requests from server1, and denies client1 if connected directly. What would be the best way to tunnel curl requests from client1 to server2 through server1.

like image 461
Arman Avatar asked Sep 27 '18 18:09

Arman


2 Answers

Configure a proxy (like squid) to listen on some port on server1. When client will send request to server1, the request will get forwarded to server2.

like image 149
Deepak Garud Avatar answered Oct 01 '22 08:10

Deepak Garud


Assuming you have ssh access on server1, this can be easily done using :

ssh user@server1 curl server2/some/path

You can modify the curl command for PUT, POST accordingly.

like image 40
Gautam Avatar answered Oct 01 '22 07:10

Gautam