SSL certificates
HTTP-01 challenge
error code 404
status code troubleshooting
web server configuration

Waiting for HTTP-01 challenge propagation wrong status code '404', expected '200'

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

When setting up HTTPS for your domain using Let's Encrypt, a common challenge is the HTTP-01 challenge. This is one method used by Let's Encrypt to verify domain ownership. However, during this process, many encounter the following error: "Waiting for HTTP-01 challenge propagation: wrong status code '404', expected '200'." This error occurs during the verification step when the Let's Encrypt server tries to access a file served over HTTP on your domain but receives a 404 error instead of the expected 200 status code. This indicates that some issue is preventing the challenge from being served correctly.

In this article, we'll explore what this error means, why it might occur, and possible solutions to troubleshoot and resolve it.

Understanding the HTTP-01 Challenge

Let's Encrypt uses the ACME (Automated Certificate Management Environment) protocol to issue certificates. The HTTP-01 challenge is part of this protocol and works as follows:

  1. Challenge Generation: Let's Encrypt generates a unique token for your domain.
  2. Web Server Configuration: You need to serve a specific HTTP resource at http:// <your-domain> /.well-known/acme-challenge/ <token> ``.
  3. Verification: Let's Encrypt attempts to retrieve the file. The server expects a 200 HTTP status code, confirming domain control.

Why "404 Not Found" Can Occur

Common Causes

  1. File Placement:
    • The challenge file might not be in the correct directory or does not exist.
  2. Web Server Misconfiguration:
    • The web server might not have correct permissions or configurations to serve files from the .well-known/acme-challenge/ directory.
  3. DNS Propagation:
    • If you've recently updated your DNS records, changes might not have propagated fully across the internet.
  4. Cache Interference:
    • Proxy servers or CDNs might cache an older version or a 404 error, preventing the challenge file from being correctly accessed.
  5. URL Rewrites/Redirects:
    • Rewrite rules in .htaccess or server configuration could redirect requests away from the .well-known/ path.

Troubleshooting Steps

Verifying File Presence

First, ensure that the challenge file is present at the correct location:

  • Local path typically used: /var/www/your-domain/.well-known/acme-challenge/ .
  • You can test manually retrieving the file through your browser or using curl :

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.