Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Nginx Forwarding Proxy Behind Internal Application Load Balancer

Is it possible to forward traffic from Application Load Balancer to Nginx Forward proxy. We are encountering 504 Gateway timeout issue when trying access the Nginx Forward Proxy via Application load balancer.

We have already configured and open the ports needed from the firewall but no luck

Thank you

2 1 459
1 REPLY 1

Hi @rvenus ,

It should be possible to forward traffic from an Application Load Balancer to an Nginx forward proxy. But, if you are encountering a 504 Gateway Timeout issue, there might be an issue with the communication between them.

You can check the following :

On GCP side:
Check the access logs on the ALB to see if the requests are reaching the ALB and if there are any indications of issues in the communication between the ALB and the Nginx proxy. You can also double-check the firewall rules if they are correctly configured to allow traffic from the ALB to the Nginx proxy on the required ports. Make sure there are no network-level restrictions preventing communication. Lastly, if you're using instances in a Virtual Private Cloud (VPC), check the security groups or network tags assigned to your instances to ensure they allow traffic from the ALB.

Nginx:
Review the Nginx error logs to see if there are any specific error messages or warnings that could provide insight into the cause of the 504 Gateway Timeout. Look for entries related to the time of the timeout. Use "tail -f /var/log/nginx/error.log". Make sure also that the Nginx instances are healthy and running. If the instances are not responding or are experiencing high load, it could lead to timeouts. Speaking of timeouts, if necessary, consider increasing the timeout values on both the ALB and Nginx to allow for longer processing times.

Let me know if this will help you identify the cause of the 504 gateway timeout error.