# Azure Front Door 502

> Front Door returns 502 on HTTPS when the origin is an IP address, its certificate name does not match, or the chain is incomplete. Test it with openssl and fix.

Canonical: https://scaplet.com/errors/cdn/azure-front-door-502

Guide Microsoft Azure Error · CDN and hosting errors

Front Door returns 502 on HTTPS when the origin is an IP address, its certificate name does not match, or the chain is incomplete. Test it with openssl and fix.

4 min

read

4

sources

Oct 31, 2026

updated

Scaplet Editorial Team

author

In one line

Azure Front Door returns a 502 only for HTTPS-enabled endpoints, and Microsoft names three causes: the origin hostname is an IP address, the origin's certificate doesn't match the origin FQDN, or the origin sends a certificate without a complete chain. Your browser hides the third one, so test the origin with `openssl s_client -showcerts` and count the certificates it returns.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fazure-front-door-502%20(%22Azure%20Front%20Door%20502%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fazure-front-door-502%20(%22Azure%20Front%20Door%20502%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fazure-front-door-502%20(%22Azure%20Front%20Door%20502%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fazure-front-door-502%20(%22Azure%20Front%20Door%20502%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 4 minutes.

1. [Why only HTTPS endpoints fail 01](#why-only-https-endpoints-fail)
2. [Check it in 2 minutes: count the certificates the origin sends 02](#check-it-in-2-minutes-count-the-certificates-the-origin-send)
3. [Fix by cause 03](#fix-by-cause)
4. [Not every 5xx from Front Door is a 502 04](#not-every-5xx-from-front-door-is-a-502)
5. [What a Front Door 502 means for SEO 05](#what-a-front-door-502-means-for-seo)

_01_The three causes in Microsoft's troubleshooting guide

## Why only HTTPS endpoints fail

Front Door ends the client's TLS session at the edge, then opens a new TLS connection to your origin and re-encrypts the data. A 502 happens when that second connection is refused on certificate grounds. That explains Microsoft's telltale symptom: requests sent straight to the origin succeed, and the same requests through Front Door fail with 502.

Cause

### Origin hostname is an IP address

Why Front Door rejects it

The certificate name check cannot match an IP. Front Door also uses the origin host name as the SNI header, and a certificate that needs a matching SNI may reject the request

Fix

Use an FQDN with a valid certificate, or disable the name check

Cause

### Certificate does not match the origin FQDN

Why Front Door rejects it

By default Front Door checks that the origin hostname matches the certificate name or an entry in the subject alternative names

Fix

Return a matching certificate, or disable `EnforceCertificateNameCheck`

Cause

### Certificate returned without a complete chain

Why Front Door rejects it

Front Door needs at least leaf and intermediate certificates. A leaf only gives a 502

Fix

Install the full chain on the origin

Two TLS sessions, and where the 502 comes from

```
client --TLS 1--> Front Door edge --TLS 2--> origin | | | origin hostname is an IP address ------+ | certificate name does not match FQDN ---+--> 502 | certificate chain missing intermediate -+
```

_02_Fix it on your stack

## Check it in 2 minutes: count the certificates the origin sends

Browsers are the wrong tool here. Microsoft notes that connecting to the origin directly from a browser does not show the error, because the browser rebuilds the chain it thinks it should have instead of showing what the server sent. `openssl s_client` shows exactly what was returned. Pass the origin hostname with `-connect` and `-servername`, or use `-noservername` if the origin hostname is an IP address.

Healthy origin: a leaf plus intermediates (public example, run on 2026-11-01)
Healthy origin: a leaf plus intermediates (public example, run on 2026-11-01)

```
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null 2>&1 \ | grep -E "^ *[0-9]+ s:|Verify return code"
```

Observed output: four certificates and verification succeeds
Observed output: four certificates and verification succeeds

```
0 s:CN=example.com 1 s:C=US, O=SSL Corporation, CN=Cloudflare TLS Issuing ECC CA 3 2 s:C=US, O=SSL Corporation, CN=SSL.com TLS Transit ECC CA R2 3 s:C=US, O=SSL Corporation, CN=SSL.com TLS ECC Root CA 2022 Verify return code: 0 (ok)
```

Incomplete chain: a public test host that sends only the leaf
Incomplete chain: a public test host that sends only the leaf

```
openssl s_client -connect incomplete-chain.badssl.com:443 -servername incomplete-chain.badssl.com -showcerts </dev/null 2>&1 \ | grep -E "^ *[0-9]+ s:|Verify return code"
```

Observed output: one certificate and a verification failure
Observed output: one certificate and a verification failure

```
0 s:CN=*.badssl.com Verify return code: 21 (unable to verify the first certificate)
```

That second output is the shape of cause three. Point the same command at your own origin hostname. If you see only line `0` and a nonzero verify code, the origin is serving a leaf without its intermediates, and Front Door will answer 502. The other two causes need no tool: compare your origin hostname in the Front Door settings with the certificate's subject name on line `0`.

_03_How it works

## Fix by cause

1. 1

### Origin is an IP address

Change the origin to an FQDN that has a valid certificate matching the origin, as Microsoft recommends. If you must keep the IP, disable the name check, and know that an origin whose certificate logic needs a valid SNI may still reject requests.
2. 2

### Certificate name mismatch

Issue or install a certificate whose subject name or a subject alternative name matches the origin hostname configured in Front Door.
3. 3

### Incomplete chain

Install the leaf and intermediate certificates together on the origin. For Front Door, the root CA must be part of the Microsoft Trusted CA List, and a certificate from a CA that is not on it is rejected.
4. 4

### Only if you accept the trade-off

Disabling the name check is documented as a workaround, for example for testing. The origin must still present a valid, trusted chain.

Disable the certificate name check on one origin (Front Door Standard or Premium; needs your profile)

```
az afd origin update \ --resource-group <resource-group> \ --profile-name <profile-name> \ --origin-group-name <origin-group-name> \ --origin-name <origin-name> \ --enforce-certificate-name-check false
```

I checked in the installed Azure CLI help that `az afd origin update` takes these arguments, including `--enforce-certificate-name-check`. I did not run it against a profile. In the portal, Standard and Premium keep this setting with the origin settings when you add an origin to an origin group or configure a route.

**Name check off is the last resort**With the check disabled, Front Door no longer proves it is talking to the host you meant. Prefer the matching certificate, and use the setting only where you have another way to trust the origin.

_04_Explained

## Not every 5xx from Front Door is a 502

Two neighbours get mistaken for it. A 504 means the origin did not answer within the Origin response timeout, which Microsoft says defaults to 30 seconds and which can be raised on Standard and Premium to between 16 and 240 seconds, shown on the Front Door profile's overview page. A 429 is Front Door applying default platform rate limits. If your errors are 504 and the origin takes about 30 seconds, the certificate steps above will not help; see [504 Gateway Timeout](/errors/http/504) and the wider [502 on Azure](/errors/http/502/azure) page for App Service and Application Gateway.

_05_Explained

## What a Front Door 502 means for SEO

Because the certificate sits at the origin, one defect fails every URL routed to it, so this 502 is site-wide instead of page by page. Google's [status code](/glossary/http-status-codes) guide says crawlers slow down when they see 5xx, and indexed URLs can be dropped if the failures last. A certificate renewal that installs only the leaf matches cause three, and would turn a working site into a total 502 on the day it takes effect. For finding the affected URLs, see [5xx server errors](/seo-issues/server-errors-5xx).

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ Why does my site work directly but return 502 through Front Door?

Microsoft's guide lists three causes that only appear on [HTTPS](/glossary/https) endpoints: the origin hostname is an IP address, the certificate does not match the origin FQDN, or the certificate chain is incomplete. Direct requests skip Front Door's origin TLS checks.

_02_ Why does my browser show the origin certificate as fine?

Browsers rebuild the chain of trust themselves rather than showing exactly what the server returned. Use `openssl s_client -showcerts` with `-connect` and `-servername` to see what the origin actually sends.

_03_ What is EnforceCertificateNameCheck?

A Front Door setting, enabled by default, that checks the origin hostname against the origin certificate's name or one of its subject alternative names. Disabling it is documented as a workaround, and the certificate must still carry a valid, trusted chain.

Sources · 4

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- microsoft.com
- google.com

1. 01 [Microsoft Learn: Troubleshoot common Azure Front Door issues](https://learn.microsoft.com/en-us/azure/frontdoor/troubleshoot-issues) learn.microsoft.com · checked 2026-11-01
2. 02 [Microsoft Learn: End-to-end TLS with Azure Front Door](https://learn.microsoft.com/en-us/azure/frontdoor/end-to-end-tls) learn.microsoft.com · checked 2026-11-01
3. 03 [Microsoft Learn: az afd origin](https://learn.microsoft.com/en-us/cli/azure/afd/origin) learn.microsoft.com · checked 2026-11-01
4. 04 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-11-01

## Keep learning

[All errors](/errors)

[Learn 502 Bad Gateway on Azure HTTP status codes](/errors/http/502/azure) [Related SSL certificate problem: unable to get local issuer certificate Browser errors](/errors/browser/ssl-certificate-problem-unable-to-get-local-issuer-certificate) [Read next 502 Bad Gateway HTTP status codes](/errors/http/502) [Do Run a free site audit Free, about two minutes](/site-audit)

Other 502 errors
[502 Bad Gateway on Cloudflare](/errors/http/502/cloudflare) [AWS 502 Bad Gateway](/errors/cdn/aws-502-bad-gateway) [AWS Lambda 502 Bad Gateway](/errors/cdn/aws-lambda-502) [Google Cloud 502 Bad Gateway](/errors/cdn/google-cloud-502) [Render 502 Bad Gateway](/errors/cdn/render-502)

More in CDN and hosting errors
[Vercel FUNCTION_INVOCATION_TIMEOUT](/errors/cdn/vercel-function-invocation-timeout) [Vercel: too many redirects](/errors/cdn/vercel-too-many-redirects) [Akamai reference number](/errors/cdn/akamai-reference-number) [ALB 503 Service Unavailable](/errors/cdn/alb-503) [ALB 504 Gateway Timeout](/errors/cdn/alb-504-gateway-timeout) [API Gateway 403 Forbidden](/errors/cdn/api-gateway-403-forbidden) [API Gateway 504 Gateway Timeout](/errors/cdn/api-gateway-504) [AWS 502 Bad Gateway](/errors/cdn/aws-502-bad-gateway) [AWS Amplify 404 Not Found](/errors/cdn/amplify-404) [AWS EC2: Connection timed out](/errors/cdn/aws-ec2-connection-timed-out) [AWS Lambda 502 Bad Gateway](/errors/cdn/aws-lambda-502) [AWS Lambda timeout](/errors/cdn/lambda-timeout) [Azure Front Door 502](/errors/cdn/azure-front-door-502) [Cloud Run 503 error](/errors/cdn/cloud-run-503) [Cloudflare 504 Gateway Timeout](/errors/cdn/cloudflare-504) [Cloudflare Pages 404 Not Found](/errors/cdn/cloudflare-pages-404) [Cloudflare too many redirects (ERR_TOO_MANY_REDIRECTS)](/errors/cdn/cloudflare-too-many-redirects) [Cloudflare verify you are human loop](/errors/cdn/cloudflare-verify-you-are-human-loop) [CloudFront 400: Bad Request](/errors/cdn/cloudfront-400) [CloudFront 404 Not Found](/errors/cdn/cloudfront-404) [CloudFront 503: Service Unavailable](/errors/cdn/cloudfront-503) [Firebase Hosting 404](/errors/cdn/firebase-hosting-404) [GitHub Pages 404 Not Found](/errors/cdn/github-pages-404) [Google Cloud 502 Bad Gateway](/errors/cdn/google-cloud-502)

Terms on this page
[HTTP status codes](/glossary/http-status-codes) [HTTPS](/glossary/https)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
