0

I have a gentoo linux where I run an application that makes requests to a certain domain but does not respect my proxy setting I made in the environment variables (http_proxy, https_proxy, HTTP_PROXY, HTTPS_PROXY).

Unfortunately I can't configure that application to respect my proxy.

So I wonder if it is possible, to redirect these request to the proxy server manually.

My idea was an entry in /etc/hosts ?

Is it right that etc/hosts takes precedence before my dns server, to resolve the request?

Does anybody know if that is possible or has alternative ideas to redirect requests to certain domains to my proxy server?

If this is possible what would be the entry need to look like. Given the request is made to anydomain.com and my proxy is my.proxy.com:1234?

Thanks alot!

5
  • 2
    You can only redirect to a different IP through the hosts file, not to a different port. You need to run the proxy on the same port as the target service. Nov 28, 2018 at 9:23
  • Thx, unfortunately I cant change the proxy port, so that option with etc/hosts does not seems promising. Can you think of any other option to map the request to the proxy?
    – TVK
    Nov 28, 2018 at 9:31
  • 1
    The typical solution for applications that don't support an explicit proxy configuration is to either run a transparent proxy server (and use firewall rules or DNS overrides to redirect outgoing traffic to the proxy) or point the the application to a reverse proxy server (rather than the actual external URL), that will intercept the requests, forward those to your explicit proxy and then on to the online resource (for instance with Apache ProxyRemote )
    – HBruijn
    Nov 28, 2018 at 9:42
  • Thx alot, i'll do some investigation on this.
    – TVK
    Nov 28, 2018 at 9:46
  • Am I right, that i could configure a reverse proxy in nginx to forward a specific request to our corporate proxy?
    – TVK
    Nov 30, 2018 at 10:26

0

You must log in to answer this question.

Browse other questions tagged .