Forum Discussion

ravigodara's avatar
ravigodara
Icon for Nimbostratus rankNimbostratus
Oct 16, 2023

How to configure Nginx to use another HTTP proxy server for some locations .

I am using Nginx as a reverse proxy server, where I receive request from Client, reverse-proxy serves it and return back to client, reverse proxy does not have access to public internet and have to reach there by using HTTP proxy.
 

With new require I have to add authentication for which I need to reach to public internet for few locations configured in nginx conf as below

location ^~ /getbearertoken {
internal;
proxy_http_version 1.1;
proxy_pass ${arg_url}/token/${arg_org}/v2/actions/GetBearerToken/invoke;
proxy_ssl_server_name on;
}
location ^~ /getaccesstoken {
internal;
proxy_http_version 1.1;
proxy_pass ${arg_url}/oauth2/v1/access_token;
proxy_ssl_server_name on;
}

Now problem is connection times out as it is not able to reach public internet.

Is there any config where I can mention to reach this location via proxy server?