when this happens, you should verify what URL openwisp-config is trying to fetch and call the same curl command the agent is calling to see the result.
That response is coming from nginx, so nginx is replying 404, the reasons could be many:
This is how a good response looks like, you can try this command and see what you receive:
curl -v -I "$(uci get openwisp.http.url)"
> HEAD / HTTP/1.1
> Host: openwisp.******.com
> User-Agent: curl/7.77.0
> Accept: */*
>
< HTTP/1.1 302 Found
HTTP/1.1 302 Found
< Server: nginx/1.18.0 (Ubuntu)
Server: nginx/1.18.0 (Ubuntu)
< Date: Mon, 19 Jul 2021 20:42:37 GMT
Date: Mon, 19 Jul 2021 20:42:37 GMT
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Content-Length: 0
Content-Length: 0
< Connection: keep-alive
Connection: keep-alive
< Location: /admin/
Location: /admin/
< X-Frame-Options: DENY
X-Frame-Options: DENY
< Vary: Origin, Accept-Language
Vary: Origin, Accept-Language
< Content-Language: en
Content-Language: en
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
Referrer-Policy: same-origin
< Strict-Transport-Security: max-age=31536000
Strict-Transport-Security: max-age=31536000
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff