You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After configuring an application gateway, one of the errors that users may encounter is "Server Error: 502 - Web server received an invalid response while acting as a gateway or proxy server". This error may happen due to the following main reasons:
20
+
After configuring an application gateway, one of the errors that you may see is "Server Error: 502 - Web server received an invalid response while acting as a gateway or proxy server". This error may happen for the following main reasons:
31
21
32
-
* NSG, UDR or Custom DNS is blocking access to backend pool members.
33
-
* Back-end VMs or instances of virtual machine scale set are not responding to the default health probe.
22
+
* NSG, UDR, or Custom DNS is blocking access to backend pool members.
23
+
* Back-end VMs or instances of virtual machine scale set aren't responding to the default health probe.
34
24
* Invalid or improper configuration of custom health probes.
35
-
* Azure Application Gateway's [back-end pool is not configured or empty](#empty-backendaddresspool).
25
+
* Azure Application Gateway's [back-end pool isn't configured or empty](#empty-backendaddresspool).
36
26
* None of the VMs or instances in [virtual machine scale set are healthy](#unhealthy-instances-in-backendaddresspool).
37
27
*[Request time-out or connectivity issues](#request-time-out) with user requests.
38
28
39
29
## Network Security Group, User Defined Route, or Custom DNS issue
40
30
41
31
### Cause
42
32
43
-
If access to backend is blocked due to presence of NSG, UDR or custom DNS, Application Gateway instances will not be able to reach the backend pool and would result in probe failures causing 502 errors. Note that the NSG/UDR could be present either in Application Gateway subnet or the subnet where the application VMs are deployed. Similarly presence of custom DNS in the VNET could also cause issues if FQDN is used for backend pool members and is not resolved correctly by the user configured DNS server for the VNET.
33
+
If access to the backend is blocked because of an NSG, UDR, or custom DNS, application gateway instances can't reach the backend pool. This causes probe failures, resulting in 502 errors.
34
+
35
+
The NSG/UDR could be present either in the application gateway subnet or the subnet where the application VMs are deployed.
36
+
37
+
Similarly, the presence of a custom DNS in the VNet could also cause issues. A FQDN used for backend pool members might not resolve correctly by the user configured DNS server for the VNet.
44
38
45
39
### Solution
46
40
47
41
Validate NSG, UDR, and DNS configuration by going through the following steps:
48
-
* Check NSGs associated with Application Gateway subnet. Ensure that communication to backend is not blocked.
49
-
* Check UDR associated with Application Gateway subnet. Ensure that UDR is not directing traffic away from backend subnet - for example check for routing to network virtual appliances or default routes being advertised to Application Gateway subnet via ExpressRoute/VPN.
50
42
51
-
```powershell
43
+
* Check NSGs associated with the application gateway subnet. Ensure that communication to backend isn't blocked.
44
+
* Check UDR associated with the application gateway subnet. Ensure that the UDR isn't directing traffic away from the backend subnet. For example, check for routing to network virtual appliances or default routes being advertised to the application gateway subnet via ExpressRoute/VPN.
If present, ensure that the DNS server is able to resolve backend pool member's FQDN correctly.
68
+
If present, ensure that the DNS server can resolve the backend pool member's FQDN correctly.
74
69
75
70
## Problems with default health probe
76
71
77
72
### Cause
78
73
79
-
502 errors can also be frequent indicators that the default health probe is not able to reach back-end VMs. When an Application Gateway instance is provisioned, it automatically configures a default health probe to each BackendAddressPool using properties of the BackendHttpSetting. No user input is required to set this probe. Specifically, when a load balancing rule is configured, an association is made between a BackendHttpSetting and BackendAddressPool. A default probe is configured for each of these associations and Application Gateway initiates a periodic health check connection to each instance in the BackendAddressPool at the port specified in the BackendHttpSetting element. Following table lists the values associated with the default health probe.
74
+
502 errors can also be frequent indicators that the default health probe can't reach back-end VMs.
75
+
76
+
When an application gateway instance is provisioned, it automatically configures a default health probe to each BackendAddressPool using properties of the BackendHttpSetting. No user input is required to set this probe. Specifically, when a load-balancing rule is configured, an association is made between a BackendHttpSetting and a BackendAddressPool. A default probe is configured for each of these associations and the application gateway starts a periodic health check connection to each instance in the BackendAddressPool at the port specified in the BackendHttpSetting element.
77
+
78
+
The following table lists the values associated with the default health probe:
80
79
81
80
| Probe property | Value | Description |
82
81
| --- | --- | --- |
@@ -89,66 +88,68 @@ If present, ensure that the DNS server is able to resolve backend pool member's
89
88
90
89
* Ensure that a default site is configured and is listening at 127.0.0.1.
91
90
* If BackendHttpSetting specifies a port other than 80, the default site should be configured to listen at that port.
92
-
* The call to `http://127.0.0.1:port` should return an HTTP result code of 200. This should be returned within the 30 sec time-out period.
93
-
* Ensure that port configured is open and that there are no firewall rules or Azure Network Security Groups, which block incoming or outgoing traffic on the port configured.
94
-
* If Azure classic VMs or Cloud Service is used with FQDN or Public IP, ensure that the corresponding [endpoint](../virtual-machines/windows/classic/setup-endpoints.md?toc=%2fazure%2fapplication-gateway%2ftoc.json) is opened.
95
-
* If the VM is configured via Azure Resource Manager and is outside the VNet where Application Gateway is deployed, [Network Security Group](../virtual-network/security-overview.md) must be configured to allow access on the desired port.
91
+
* The call to `http://127.0.0.1:port` should return an HTTP result code of 200. This should be returned within the 30-second timeout period.
92
+
* Ensure that the port configured is open and that there are no firewall rules or Azure Network Security Groups, which block incoming or outgoing traffic on the port configured.
93
+
* If Azure classic VMs or Cloud Service is used with a FQDN or a public IP, ensure that the corresponding [endpoint](../virtual-machines/windows/classic/setup-endpoints.md?toc=%2fazure%2fapplication-gateway%2ftoc.json) is opened.
94
+
* If the VM is configured via Azure Resource Manager and is outside the VNet where the application gateway is deployed, a[Network Security Group](../virtual-network/security-overview.md) must be configured to allow access on the desired port.
96
95
97
96
## Problems with custom health probe
98
97
99
98
### Cause
100
99
101
-
Custom health probes allow additional flexibility to the default probing behavior. When using custom probes, users can configure the probe interval, the URL, and path to test, and how many failed responses to accept before marking the back-end pool instance as unhealthy. The following additional properties are added.
100
+
Custom health probes allow additional flexibility to the default probing behavior. When you use custom probes, you can configure the probe interval, the URL, the path to test, and how many failed responses to accept before marking the back-end pool instance as unhealthy.
101
+
102
+
The following additional properties are added:
102
103
103
104
| Probe property | Description |
104
105
| --- | --- |
105
106
| Name |Name of the probe. This name is used to refer to the probe in back-end HTTP settings. |
106
107
| Protocol |Protocol used to send the probe. The probe uses the protocol defined in the back-end HTTP settings |
107
-
| Host |Host name to send the probe. Applicable only when multi-site is configured on Application Gateway. This is different from VM host name. |
108
+
| Host |Host name to send the probe. Applicable only when multi-site is configured on the application gateway. This is different from VM host name. |
108
109
| Path |Relative path of the probe. The valid path starts from '/'. The probe is sent to \<protocol\>://\<host\>:\<port\>\<path\>|
109
110
| Interval |Probe interval in seconds. This is the time interval between two consecutive probes. |
110
-
| Time-out |Probe time-out in seconds. If a valid response is not received within this time-out period, the probe is marked as failed. |
111
+
| Time-out |Probe time-out in seconds. If a valid response isn't received within this time-out period, the probe is marked as failed. |
111
112
| Unhealthy threshold |Probe retry count. The back-end server is marked down after the consecutive probe failure count reaches the unhealthy threshold. |
112
113
113
114
### Solution
114
115
115
116
Validate that the Custom Health Probe is configured correctly as the preceding table. In addition to the preceding troubleshooting steps, also ensure the following:
116
117
117
118
* Ensure that the probe is correctly specified as per the [guide](application-gateway-create-probe-ps.md).
118
-
* If Application Gateway is configured for a single site, by default the Host name should be specified as `127.0.0.1`, unless otherwise configured in custom probe.
119
+
* If the application gateway is configured for a single site, by default the Host name should be specified as `127.0.0.1`, unless otherwise configured in custom probe.
119
120
* Ensure that a call to http://\<host\>:\<port\>\<path\> returns an HTTP result code of 200.
120
-
* Ensure that Interval, Time-out and UnhealtyThreshold are within the acceptable ranges.
121
+
* Ensure that Interval, Timeout, and UnhealtyThreshold are within the acceptable ranges.
121
122
* If using an HTTPS probe, make sure that the backend server doesn't require SNI by configuring a fallback certificate on the backend server itself.
122
123
123
124
## Request time-out
124
125
125
126
### Cause
126
127
127
-
When a user request is received, Application Gateway applies the configured rules to the request and routes it to a back-end pool instance. It waits for a configurable interval of time for a response from the back-end instance. By default, this interval is **30 seconds**. If Application Gateway does not receive a response from back-end application in this interval, user request would see a 502 error.
128
+
When a user request is received, the application gateway applies the configured rules to the request and routes it to a back-end pool instance. It waits for a configurable interval of time for a response from the back-end instance. By default, this interval is **20** seconds. If the application gateway does not receive a response from back-end application in this interval, the user request gets a 502 error.
128
129
129
130
### Solution
130
131
131
-
Application Gateway allows users to configure this setting via BackendHttpSetting, which can be then applied to different pools. Different back-end pools can have different BackendHttpSetting and hence different request time-out configured.
132
+
Application Gateway allows you to configure this setting via the BackendHttpSetting, which can be then applied to different pools. Different back-end pools can have different BackendHttpSetting, and a different request time-out configured.
If the Application Gateway has no VMs or virtual machine scale set configured in the back-end address pool, it cannot route any customer request and throws a bad gateway error.
142
+
If the application gateway has no VMs or virtual machine scale set configured in the back-end address pool, it can't route any customer request and sends a bad gateway error.
142
143
143
144
### Solution
144
145
145
-
Ensure that the back-end address pool is not empty. This can be done either via PowerShell, CLI, or portal.
146
+
Ensure that the back-end address pool isn't empty. This can be done either via PowerShell, CLI, or portal.
The output from the preceding cmdlet should contain non-empty back-end address pool. Following is an example where two pools are returned which are configured with FQDN or IP addresses for backend VMs. The provisioning state of the BackendAddressPool must be 'Succeeded'.
152
+
The output from the preceding cmdlet should contain non-empty back-end address pool. The following example shows two pools returned which are configured with a FQDN or an IP addresses for the backend VMs. The provisioning state of the BackendAddressPool must be 'Succeeded'.
152
153
153
154
BackendAddressPoolsText:
154
155
@@ -180,13 +181,13 @@ BackendAddressPoolsText:
180
181
181
182
### Cause
182
183
183
-
If all the instances of BackendAddressPool are unhealthy, then Application Gateway would not have any back-end to route user request to. This could also be the case when back-end instances are healthy but do not have the required application deployed.
184
+
If all the instances of BackendAddressPool are unhealthy, then the application gateway doesn't have any back-end to route user request to. This can also be the case when back-end instances are healthy but don't have the required application deployed.
184
185
185
186
### Solution
186
187
187
-
Ensure that the instances are healthy and the application is properly configured. Check if the back-end instances are able to respond to a ping from another VM in the same VNet. If configured with a public end point, ensure that a browser request to the web application is serviceable.
188
+
Ensure that the instances are healthy and the application is properly configured. Check if the back-end instances can respond to a ping from another VM in the same VNet. If configured with a public end point, ensure a browser request to the web application is serviceable.
188
189
189
190
## Next steps
190
191
191
-
If the preceding steps do not resolve the issue, open a [support ticket](https://azure.microsoft.com/support/options/).
192
+
If the preceding steps don't resolve the issue, open a [support ticket](https://azure.microsoft.com/support/options/).
0 commit comments