0

I have an AWS elb loadbalancer with three dynamic IPs and domain- example.com, port 443.

our client wants to access API but he had outbound firewall rules which required to whitelist dynamic IPs every time.

for the resolution, we created a subdomain (api.example.com) with elastic IP and Nginx reverse proxy. So every request that comes on api.example.com will be forwarded to example.com.

The issue is that if the client allowlists proxy server IP and make a request on the proxy server(api.example.com) he is getting a timeout error.

But if he disabled the firewall everything worked fine.

flow diagram- https://snipboard.io/9V5al6.jpg

// server configuration api.pelocal.com

server {

server_name   api.example.com ;

resolver 8.8.8.8  valid=10s;
resolver_timeout 10s;
set $upstream_endpoint https://example.com;

location / {

    proxy_redirect              off;
    proxy_read_timeout          3600;
    proxy_connect_timeout       1m;
    proxy_set_header Connection "";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
    
    proxy_pass $upstream_endpoint; 
    proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  }
}

please help. Thanks in advance.

Jams Rob
  • 1
  • 1
  • A timeout usually points toward a firewall issue. If you get the error only when you don't whitelist the target IPs chances are that something in your backend sends a redirect with the wrong IP. Please use a command line client (curl, wget) to test the request and post the complete output (including response headers). – Gerald Schneider Jul 14 '22 at 06:45
  • @GeraldSchneider Thanks for your comment. here is screenshot of flow diagram.https://snipboard.io/9V5al6.jpg – Jams Rob Jul 14 '22 at 07:13
  • The diagram is not helpful. Please run the suggested commands. – Gerald Schneider Jul 14 '22 at 07:14
  • @GeraldSchneider updated question , please check. – Jams Rob Jul 14 '22 at 07:45

0 Answers0