I want to rewrite the URL to which a specific program in the server accesses the outside world.

Asked 2 years ago, Updated 2 years ago, 43 views

Multiple scripts are written in multiple languages on the server (CentOS 7).

without rewriting the URLs referenced by all these scripts individually. Monitor access to those scripts, like a firewall, and
If these scripts attempt to browse outside the server (e.g.http://hoge1.hoge),
I'm trying to find a way to change this to another URL (e.g.http://hoge2.hoge) to get access.
Is this possible?
I'd appreciate it if you could just give me keywords for searching.

linux

2022-09-30 20:12

1 Answers

I think we will have an HTTP proxy to rewrite the access and let it go through.
Many programs that communicate with HTTP follow it by referring to the environment variables HTTP_PROXY and http_proxy, so this is usually configured.

To accommodate programs that do not respect these settings, we use a mechanism called a "transparent proxy."
Transparent proxy requires OS-level support, and for Linux, you can set it to iptables.
(It might be difficult to say "only certain programs".Would you like to keep the program in a container?)


2022-09-30 20:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.