R
R
rizzli2018-09-28 03:48:46
linux
rizzli, 2018-09-28 03:48:46

How to redirect outgoing requests of a specific application to a proxy?

There is a small NodeJs service that accepts requests and sends a webhook to a third-party service and returns a response.
The third-party service is hosted on AWS and blocked addresses periodically come across. And as a solution, is it possible to redirect requests of this particular backend to a proxy? Without rewriting the backend itself.
I feel that it is possible to do this with iptables, but I can not think of how.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2018-09-28
@q2digger

There is an owner module for iptables that allows you to filter by the owner of a running process.
I see it this way. Run your application as a separate user, the line for iptables will be something like:
Found the description of the module:

https://www.frozentux.net/iptables-tutorial/iptabl...

E
edk55, 2018-09-28
@edk55

Might be worth trying proxychains. It does not work in all cases, but it should cope with a bang with a regular script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question