How to Debug “502 Bad Gateway” on Azure Container App with Ingress Enabled

Rochin 5 20 Reputation points
2025-05-23T12:28:23.3333333+00:00

Hi,

I have deployed a container app with external ingress enabled. When accessing the public URL, I get a 502 Bad Gateway error.

The container starts successfully and logs show the app is listening on PORT=8080. I have set the targetPort to 8080 in the container app configuration. No issues when running the same image locally. Is there a way to get more diagnostics on ingress errors or a checklist to ensure proper ingress configuration?

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
686 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ranashekar Guda 2,820 Reputation points Microsoft External Staff Moderator
    2025-05-23T20:30:54.5666667+00:00

    Hello @Rochin 5,

    To troubleshoot a “502 Bad Gateway” error on your Azure Container App with ingress enabled, start by ensuring that your ingress configuration is correct, this includes setting the targetPort to match the port your application is listening on (in your case, port 8080), and confirming that ingress is enabled with external visibility. Make sure your application is binding to 0.0.0.0:8080, not localhost, to ensure it can receive traffic from the ingress controller.

    Next, check your container logs for any runtime errors or issues, and inspect the ingress-related diagnostics in the Azure Portal under "Diagnose and solve problems," particularly the "Container Apps Ingress Port settings check." If your container app is integrated with a virtual network, verify that it has proper DNS resolution and access to any required external services.

    Also, review whether any health probes are configured, as misconfigured liveness or readiness probes could cause the app to be marked as unhealthy, resulting in a 502 error. Monitoring service health and collecting diagnostic data through Azure tools can help identify whether the problem lies with ingress routing, application configuration, or external dependencies. Following these steps should help isolate and resolve the issue.

    Kindly refer below links:

    Troubleshoot a container app

    Check networking and ingress settings

    Troubleshoot target port settings in Azure Container Apps

    If you find the answer helpful, kindly click "Accept Answer" and upvote it. If you have any further questions or concerns, please feel free to reach out to us. We are happy to assist you.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.