# HTTP-01 challenge is tried using https first

**URL:** <https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798>\
**Category:** Help\
**Created:** [November 15, 2024, 4:50pm UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798 "2024-11-15T16:50:25Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![webprofusion](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/webprofusion/32/85310_2.png) [@webprofusion](https://community.letsencrypt.org/u/webprofusion)\
**Post date:** [November 19, 2024, 2:43am UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/22 "2024-11-19T02:43:08Z")

</div>

The root of the problem here is that you are looking for a bug in Let's Encrypts http domain validation, but you need to look for a bug in your own http response. The chance of it being a bug in Let's Encrypt is not zero, but the chance of it being a bug in your config is 99.999% or thereabouts.

LE will resolve your domain to a set of IPs and it will try _some_ of them as http, with a preference for IPv6. It will do this from multiple geographic locations. If any of those IPs that it tries then respond with a redirect then it will follow them. If on the other hand the IP it tried blocks http on TCP port 80 that's where it will stop (and you'll get nothing in your nginx log).

Own the problem and commit to the idea that it's your own config that's getting in the way, you'll get this fixed.

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [November 19, 2024, 3:56am UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/23 "2024-11-19T03:56:51Z")

</div>

@jean-christophe-manc I ran a test that reproduces your failed validation exactly. Even to include the IPv4 address wrongly shown with HTTPS (that is a known bug as I said).

And, the situation is exactly as I described earlier:

- I have both A and AAAA record for domain
- IPv6 inbound to my server is blocked by firewall rule
- My nginx redirects HTTP to HTTPS for all requests (even acme challenge)

This results in the same sequence in the Validation Record as I described most recently in post #21 :

- LE tried HTTP to IPv6 but times out (in this test b/c of firewall)
- LE retries HTTP to IPv4 and gets redirected to HTTPS
- LE follows redirect using IPv6 and times out again
- It does not retry IPv4 after redirect so challenge fails.

You really need to study your infrastructure. And, you need to get away from thinking that LE sends multiple simultaneous HTTP requests to each IP address. It does not. An HTTP Challenge is a sequential series of http(s) requests.

With this in mind, you still have not explained how you plan to have both of your IPv6 addresses reply correctly. LE may choose either one. And, each must be able to reply correctly. Which may involve a carefully crafted redirect. But still must result in a satisfied challenge.

---

<div class="post-metadata">

**Author:** ![jean-christophe-manc](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jean-christophe-manc/32/30127_2.png) [@jean-christophe-manc](https://community.letsencrypt.org/u/jean-christophe-manc)\
**Post date:** [November 22, 2024, 4:39pm UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/24 "2024-11-22T16:39:40Z")

</div>

> [@MikeMcQ](#):
>
> - IPv6 inbound to my server is blocked by firewall rule

Hence my earlier question "Could you give me the IPv6/IPv4 addresses of the server(s) validating the challenge?" Even a range would have been helpful to rule this out or not.

> [@MikeMcQ](#):
>
> - My nginx redirects HTTP to HTTPS for all requests (even acme challenge)

Mine did not.

> [@MikeMcQ](#):
>
> - LE retries HTTP to IPv4 and gets redirected to HTTPS

That could not have happened in my case.

> [@MikeMcQ](#):
>
> You really need to study your infrastructure.

I know mine perfectly. Do you know where LE challenge servers are located? Do they answer in the same region/country as the challenge source?

> [@MikeMcQ](#):
>
> And, you need to get away from thinking that LE sends multiple simultaneous HTTP requests to each IP address. It does not.

When/where did I write that?

> [@MikeMcQ](#):
>
> you still have not explained how you plan to have both of your IPv6 addresses reply correctly. LE may choose either one. And, each must be able to reply correctly

I have already answered that. Please read my answers carefully.

As a conclusion, considering that there was no http --\> https redirect on my side, and that all my IPv6/IPv4 addresses were operational (except for the first test), we can state that the cause of that issue comes from either:

- LE IPv6 and IPv4 addresses blocked by my firewalll which is unlikely if LE challenge servers answer in the same region/country as mine
- or an unidentified issue on LE side

I know that because I have already successfully validated an LE challenge for the same server FQDN a few months back with the same challenge type http-01... with the exact same workflow on my side as the one that was used to trigger the current issue:

```nohighlight
account_uri: https://acme-v02.api.letsencrypt.org/acme/acct/417325880
authorizations:
  sdx1-kvm.sdxlive.com:
    challenges:
    - status: valid
      token: token
      type: http-01
      url: https://acme-v02.api.letsencrypt.org/acme/chall-v3/333279173307/zLG-mA
      validated: '2024-04-01T13:17:06Z'
      validationRecord:
      - addressUsed: 2a01:e0a:81c:99c0:558c:7a:5b5c:7b5d
        addressesResolved:
        - 82.66.198.137
        - 2a01:e0a:81c:99c0:558c:7a:5b5c:7b5d
        hostname: sdx1-kvm.sdxlive.com
        port: '80'
        resolverAddrs:
        - A:10.1.12.85:30182
        - AAAA:10.1.12.81:31390
        url: http://sdx1-kvm.sdxlive.com/.well-known/acme-challenge/token
    expires: '2024-05-01T13:17:07Z'
    identifier:
      type: dns
      value: sdx1-kvm.sdxlive.com
    status: valid
    uri: https://acme-v02.api.letsencrypt.org/acme/authz-v3/333279173307
cert_days: 89
challenge_data: {}
challenge_data_dns: {}
changed: true
failed: false
finalize_uri: https://acme-v02.api.letsencrypt.org/acme/finalize/417325880/257230646757
order_uri: https://acme-v02.api.letsencrypt.org/acme/order/417325880/257230646757

```

Anyway, I have **moved on to dns-01** challenge which worked fine:

```nohighlight
account_uri: https://acme-v02.api.letsencrypt.org/acme/acct/id
authorizations:
  sdx1-kvm.sdxlive.com:
    challenges:
    - status: valid
      token: token
      type: dns-01
      url: https://acme-v02.api.letsencrypt.org/acme/chall/id/id2/id3
      validated: '2024-11-22T15:12:04Z'
      validationRecord:
      - hostname: sdx1-kvm.sdxlive.com
    expires: '2024-12-22T15:12:06Z'
    identifier:
      type: dns
      value: sdx1-kvm.sdxlive.com
    status: valid
    uri: https://acme-v02.api.letsencrypt.org/acme/authz/id/id2
cert_days: 89
challenge_data: {}
challenge_data_dns: {}
changed: true
failed: false
finalize_uri: https://acme-v02.api.letsencrypt.org/acme/finalize/id/id4
order_uri: https://acme-v02.api.letsencrypt.org/acme/order/id/id4

```

---

<div class="post-metadata">

**Author:** ![linkp](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/linkp/32/60089_2.png) [@linkp](https://community.letsencrypt.org/u/linkp)\
**Post date:** [November 22, 2024, 6:00pm UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/25 "2024-11-22T18:00:03Z")

</div>

> [@jean-christophe-manc](#):
>
> I have **moved on to dns-01** challenge

This is for the best. The HTTP-01 challenge is already proven to be incompatible with your preferred strict firewall policy. The link below goes to the relevant FAQ topic on the IP addresses used for validation.

> **[FAQ](https://letsencrypt.org/docs/faq/#what-ip-addresses-does-let-s-encrypt-use-to-validate-my-web-server)**
>
> This FAQ is divided into the following sections:
> General Questions Technical Questions General Questions What services does Let’s Encrypt offer? Let’s Encrypt is a global Certificate Authority (CA). We let people and organizations around the world...

---

<div class="post-metadata">

**Author:** ![jvanasco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jvanasco/32/55900_2.png) [@jvanasco](https://community.letsencrypt.org/u/jvanasco)\
**Post date:** [November 22, 2024, 10:25pm UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/26 "2024-11-22T22:25:58Z")

</div>

I just want to note that I have received an HTTPS redirect for all the http urls listed above.

Whenever debugging this sort of stuff, i like to use `curl -I` and I will try from my local machine, then confirm the same behavior with a few different cloud/remote server accounts I have. The reason for this is that there are sometimes geographic routing issues or networking/firewall rules that someone in place.

```nohighlight
Jonathans-MacBook:~ jvanasco$ curl -I http://sd1-kvm.sdxlive.com/.well-known/acme-challenge/Test404
HTTP/1.1 301 Moved Permanently
Date: Fri, 22 Nov 2024 22:20:29 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://sd1-kvm.sdxlive.com/.well-known/acme-challenge/Test404
Content-Security-Policy: default-src 'self'; frame-ancestors 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src https://sdxlive.com;
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block

Jonathans-MacBook:~ jvanasco$ curl -I http://sdx1-kvm.sdxlive.com/test.txt
HTTP/1.1 301 Moved Permanently
Date: Fri, 22 Nov 2024 22:21:59 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://sdx1-kvm.sdxlive.com/test.txt
Content-Security-Policy: default-src 'self'; frame-ancestors 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src https://sdxlive.com;
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [December 22, 2024, 10:26pm UTC](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798/27 "2024-12-22T22:26:37Z")

</div>

Closed on December 22, 2024, 10:26pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://community.letsencrypt.org/t/http-01-challenge-is-tried-using-https-first/228798.md?page=1)
