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 a reverse proxy with nginx.

Is it right that I could configure a reverse proxy in nginx to forward a specific request to our corporate proxy?

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 the entry need to look like. Given the request is made to anydomain.com and my proxy is my.proxy.com:1234?

1 Answer 1


This is the reverse proxy you are looking for.

http {

    upstream my_proxy  {
          server my.proxy.com:1234;

    server {
        listen 8080;

        location /path {
            proxy_buffering off;
            proxy_pass_header on;
            proxy_pass_request_headers on;
            proxy_set_header Host "anydomain.com";
            proxy_pass http://my_proxy/optiona/sub/path;

Please note that you can define multiples location to be used to different domains

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .