HTTP response codes - Azure Application Gateway (2024)

  • Article

This article gives reasons on why Azure Application Gateway returns specific HTTP response codes. Common causes and troubleshooting steps are provided to help you determine the root cause of error HTTP Response code. HTTP response codes can be returned to a client request whether or not a connection was initiated to a backend target.

3XX response codes (redirection)

300-399 responses are presented when a client request matches an application gateway rule that has redirects configured. Redirects can be configured on a rule as-is or via a path map rule. For more information about redirects, see Application Gateway redirect overview.

301 Permanent Redirect

HTTP 301 responses are presented when a redirection rule is specified with the Permanent value.

302 Found

HTTP 302 responses are presented when a redirection rule is specified with the Found value.

303 See Other

HTTP 302 responses are presented when a redirection rule is specified with the See Other value.

307 Temporary Redirect

HTTP 307 responses are presented when a redirection rule is specified with the Temporary value.

4XX response codes (client error)

400-499 response codes indicate an issue that is initiated from the client. These issues can range from the client initiating requests to an unmatched hostname, request timeout, unauthenticated request, malicious request, and more.

Application Gateway collects metrics that capture the distribution of 4xx/5xx status codes has a logging mechanism that captures information such as the URI client IP address with the response code. Metrics and logging enable further troubleshooting. Clients can also receive 4xx response from other proxies between the client device and Application Gateway. For example, CDN and other authentication providers. See the following articles for more information.

Metrics supported by Application Gateway V2 SKUDiagnostic logs

400 – Bad Request

HTTP 400 response codes are commonly observed when:

  • Non-HTTP / HTTPS traffic is initiated to an application gateway with an HTTP or HTTPS listener.
  • HTTP traffic is initiated to a listener with HTTPS, with no redirection configured.
  • Mutual authentication is configured and unable to properly negotiate.
  • The request isn't compliant to RFC.

Some common reasons for the request to be non-compliant to RFC are:

CategoryExamples
Invalid Host in request lineHost containing two colons (example.com:8090:8080)
Missing Host HeaderRequest doesn't have Host Header
Presence of malformed or illegal characterReserved characters are &,!. The workaround is to code it as a percentage. For example: %&
Invalid HTTP versionGet /content.css HTTP/0.3
Header field name and URI contain non-ASCII CharacterGET /«úü¡»¿.doc HTTP/1.1
Missing Content Length header for POST requestSelf Explanatory
Invalid HTTP MethodGET123 /index.html HTTP/1.1
Duplicate HeadersAuthorization:<base64 encoded content>, Authorization:<base64 encoded content>
Invalid value in Content-LengthContent-Length: abc,Content-Length: -10

For cases when mutual authentication is configured, several scenarios can lead to an HTTP 400 response being returned the client, such as:

  • Client certificate isn't presented, but mutual authentication is enabled.
  • DN validation is enabled and the DN of the client certificate doesn't match the DN of the specified certificate chain.
  • Client certificate chain doesn't match certificate chain configured in the defined SSL Policy.
  • Client certificate is expired.
  • OCSP Client Revocation check is enabled and the certificate is revoked.
  • OCSP Client Revocation check is enabled, but unable to be contacted.
  • OCSP Client Revocation check is enabled, but OCSP responder isn't provided in the certificate.

For more information about troubleshooting mutual authentication, see Error code troubleshooting.

401 – Unauthorized

An HTTP 401 unauthorized response is returned to the client if the client isn't authorized to access the resource. There are several reasons for 401 to be returned. The following are a few reasons with potential fixes.

  • If the client has access, it might have an outdated browser cache. Clear the browser cache and try accessing the application again.

An HTTP 401 unauthorized response can be returned to AppGW probe request if the backend pool is configured with NTLM authentication. In this scenario, the backend is marked as healthy. There are several ways to resolve this issue:

  • Allow anonymous access on backend pool.
  • Configure the probe to send the request to another "fake" site that doesn't require NTLM.
  • Not recommended, as this won't tell us if the actual site behind the application gateway is active or not.
  • Configure application gateway to allow 401 responses as valid for the probes: Probe matching conditions.

403 – Forbidden

HTTP 403 Forbidden is presented when customers are utilizing WAF skus and have WAF configured in Prevention mode. If enabled WAF rulesets or custom deny WAF rules match the characteristics of an inbound request, the client is presented a 403 forbidden response.

Other reasons for clients receiving 403 responses include:

  • You're using App Service as backend and it's configured to allow access only from Application Gateway. This can return a 403 error by App Services. This typically happens due to redirects/href links that point directly to App Services instead of pointing at the Application Gateway's IP address.
  • If you're accessing a storage blog and the Application Gateway and storage endpoint is in different region, then a 403 error is returned if the Application Gateway's public IP address isn't allow-listed. See Grant access from an internet IP range.

404 – Page not found

An HTTP 404 response can be returned if a request is sent to an application gateway that is:

  • Using a v2 sku.
  • Without a hostname match defined in any multi-site listeners.
  • Not configured with a basic listener.

408 – Request Timeout

An HTTP 408 response can be observed when client requests to the frontend listener of application gateway don't respond back within 60 seconds. This error can be observed due to traffic congestion between on-premises networks and Azure, when virtual appliance inspects the traffic, or the client itself becomes overwhelmed.

413 – Request Entity Too Large

An HTTP 413 response can be observed when using Azure Web Application Firewall on Application Gateway and the client request size exceeds the maximum request body size limit. The maximum request body size field controls overall request size limit excluding any file uploads. The default value for request body size is 128 KB. For more information, see Web Application Firewall request size limits.

499 – Client closed the connection

An HTTP 499 response is presented if a client request that is sent to application gateways using v2 sku is closed before the server finished responding. This error can be observed in 2 scenarios. The first scenario is when a large response is returned to the client and the client might have closed or refreshed the application before the server finished sending a large response. The second scenario is when the timeout on the client side is low and doesn't wait long enough to receive the response from server. In this case it's better to increase the timeout on the client. In application gateways using v1 sku, an HTTP 0 response code may be raised for the client closing the connection before the server has finished responding as well.

5XX response codes (server error)

500-599 response codes indicate a problem has occurred with application gateway or the backend server while performing the request.

500 – Internal Server Error

Azure Application Gateway shouldn't exhibit 500 response codes. Open a support request if you see this code, because this issue is an internal error to the service. For information on how to open a support case, see Create an Azure support request.

502 – Bad Gateway

HTTP 502 errors can have several root causes, for example:

  • NSG, UDR, or custom DNS is blocking access to backend pool members.
  • Backend VMs or instances of virtual machine scale sets aren't responding to the default health probe.
  • Invalid or improper configuration of custom health probes.
  • Azure Application Gateway's backend pool isn't configured or empty.
  • None of the VMs or instances in virtual machine scale set are healthy.
  • Request time-out or connectivity issues with user requests-Azure application Gateway V1 SKU sent HTTP 502 errors if the backend response time exceeds the time-out value that is configured in the Backend Setting.

For information about scenarios where 502 errors occur, and how to troubleshoot them, see Troubleshoot Bad Gateway errors.

504 – Gateway timeout

Azure application Gateway V2 SKU sent HTTP 504 errors if the backend response time exceeds the time-out value that is configured in the Backend Setting.

IIS

If your backend server is IIS, see Default Limits for Web Sites to set the timeout value. Refer to the connectionTimeout attribute for details. Ensure the connection timeout in IIS matches or does not exceed the timeout set in the backend setting.

nginx

If the backend server is nginx or nginx ingress controller, and if it has upstream servers, ensure the value of nginx:proxy_read_timeout matches or does not exceed with the timeout set in the backend setting.

Next steps

If the information in this article doesn't help to resolve the issue, submit a support ticket.

HTTP response codes - Azure Application Gateway (2024)

FAQs

What are the limitations of application gateways? ›

Application gateways are susceptible to IP spoofing. Application gateways are not good and understanding protocols such as telnet. Client software must be "smart" and know to contact the gateway. Each application to be managed needs its own gateway.

What is response code 500 in Azure? ›

500 – Internal Server Error

Open a support request if you see this code, because this issue is an internal error to the service.

What is received invalid status code 403 in the backend server's HTTP response Application Gateway? ›

A 403 Forbidden error is an HTTP status code error. This happens when a web server knows what you need from it, but it can't give you access to the directory for various reasons.

What is received invalid status code 503 in the backend server's HTTP response as per the health probe configuration? ›

The HTTP status code 503 means that the server is currently unable to handle the incoming requests. Usually, this error occurs because the server is too busy or is temporarily down for maintenance. The backend server is overloaded or beyond its capacity and cannot handle any new incoming client requests.

What is the primary disadvantage of application level gateways? ›

Disadvantages of Application-Level Gateways

The stricter the monitoring rules on the proxy server, the slower the data flow. Proxy firewalls also have major compatibility problems, as they can't support a wide variety of connection types and network protocols.

What is the application gateway limit in Azure? ›

File metadata and controls
ResourceLimit
Azure Application Gateway1,000 per region per subscription
Frontend IP configurations2
Frontend ports1001
Backend address pools100
38 more rows

What is HTTP 500 error response? ›

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.

What is 500 HTTP failure response for? ›

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This error response is a generic "catch-all" response.

What is the difference between 400 and 500 response code? ›

A first digit of 4 represents a client—side error, with the most common codes in the range of 400 to 404. A first digit of 5 represents a server—side error, with the most common codes in the range of 500 to 510. Because the codes in 400 and 500 range represent errors, they are also referred to as HTTP Error Codes.

What is HTTP code 403 response? ›

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it. This status is similar to 401 , but for the 403 Forbidden status code, re-authenticating makes no difference.

What is a 403 response from API gateway? ›

If a request to a deployed API returns an HTTP 403 error to the API client, it means the requested URL is valid but access is forbidden for some reason. A deployed API has the permissions associated with roles granted to the service account that you used when you created the API config.

What is invalid HTTP response code 403? ›

What is the 403 Forbidden Error? The 403 Forbidden error indicates that the server understands the request but can't provide additional access. This means that the web page you're trying to open in your browser is a resource that you're not allowed to access.

How do I fix HTTP response code 503? ›

How to Resolve the 503 Error
  1. Check Resource Usage. The resources that a server uses are RAM, CPU, I/O, entry processes, and website inodes. ...
  2. Check for Ongoing Maintenance. ...
  3. Stop Running Processes. ...
  4. Reset Firewall. ...
  5. Check Server Logs and Fix the Code. ...
  6. Restart Your Server and Networking Equipment. ...
  7. Check Your DNS.
Mar 20, 2024

What is the difference between HTTP 502 and 503? ›

Examples include 500 (Internal Server Error), 502 (Bad Gateway), and 503 (Service Unavailable).

What does a 503 response code indicates a bad gateway? ›

The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.

What are the limitations of application-level security? ›

The disadvantages of using application-layer security include the following. The application is dependent on security attributes that are not transferable between application types. Support for multiple protocols makes this type of security vulnerable. Data is close to or contained within the point of vulnerability.

Does application gateway support rate limiting? ›

You can configure multiple rate limit rules that match different variables and paths within your policy. Application Gateway WAF_v2 also introduces a GroupByUserSession, which must be configured. The GroupByUserSession specifies how requests are grouped and counted for a matching rate limit rule.

What is the purpose of application gateway? ›

App gateways help businesses improve user satisfaction by simplifying and unifying remote access security, and they reduce IT operations expense and complexity by eliminating the need for costly and complicated VPNs.

Which is the main advantage of having an application gateway? ›

Application gateways also permit the use of simpler filtering rules. Instead of having to route application traffic to several different systems, it only need be routed to the application gateway; all other traffic can be rejected.

Top Articles
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 5703

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.