DEV Community

Discussion on: Hosting WordPress over HTTPS with Docker

Collapse
 
foresthoffman profile image
Forest Hoffman • Edited

From my understanding they are performed over HTTP, yes. That's the reason that the redirection block and SSL blocks are commented out in step 3 of the Installing SSL Certificates with Certbot section.

Thanks!

Collapse
 
cduv profile image
DUVERGIER Claude

Right, but I don't see where this "force-all-HTTP-traffic-to-HTTPS part gets disabled/commented when certificate renewal occurs.

When I configure certificate on a "force HTTPS" Nginx configuration, I have the following in HTTP server block:

location ^~ /.well-known/acme-challenge/ {
    # No HTTP authentication
    allow all;

    # Set correct content type. According to this:
    # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
    # Current specification requires "text/plain" or no content header at all.
    # It seems that "text/plain" is a safe option.
    default_type "text/plain";
}
location = /.well-known/acme-challenge/ {
    return 404;
}

# Redirect the rest of HTTP traffic to HTTPS:
location / {
    return 301 https://$host$request_uri;
    access_log off;
}

Thus ACME challenge gets served over HTTP, and the other requests are redirected to HTTPS.

Thread Thread
 
foresthoffman profile image
Forest Hoffman

Oh, interesting. I didn't know this was a potential issue. Thankfully, I've got quite a while before my certs need renewing. Thank you for bringing this to my attention!

Thread Thread
 
cduv profile image
DUVERGIER Claude

You're welcome :)

Thread Thread
 
foresthoffman profile image
Forest Hoffman

Updated! Thank you again. :)