Linux Mastering Development

How to forward path along with port

I’m willing to bet I have a fundamental misunderstanding here, but I am trying to do something akin to port-forwarding AND url-forwarding without using something like nginx.

I have a remote linux instance (EC2) that can connect to a database (Neptune) on port 8182. Only the instance can connect to Neptune, I cannot connect directly from my localhost. I also have a UI tool for the database (GraphExp) that works by connecting to my localhost port 8182, and I want that UI tool to connect to the database through my remote instance.

UI –> localhost:8182 –> –>

The problem is that, in order for a query to the database to work, it has to be sent to the /gremlin path.

For example, if I am SSH’ed onto the EC2 instance, I can successfully query the database with the following command

curl -X POST -H 'Content-Type:application/json' -d '{"gremlin":"g.V().groupCount().by(label)"}'

The UI tool, on the other hand, only sends a request to port 8182, with no path. I have tried setting up port-forwarding as follows:

ssh -vL -i key.pem

However, the request gets forwarded to without the /gremlin path.

How can I set up a relationship between these servers so that requests to my local port 8182 get forwarded to the database’s port 8182 with the appended path?

Ideally, I would like a solution that involves unix commands that are preinstalled or come with package managers, so that I can avoid heavier technologies like NGinX. But I’ll start with anything that works, beggars can’t be choosers. 🙂

Thanks for your help!

Leave a Reply

Your email address will not be published. Required fields are marked *