[GH-ISSUE #2085] NPM tries to handle requests interally for /.well-known/acme-challenge/* and responds with 404 #1501

Closed
opened 2026-02-26 07:31:19 +03:00 by kerem · 4 comments
Owner

Originally created by @lriley2020 on GitHub (May 31, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2085

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

I am running a Mailcow server behind NPM and need to get Letsencrypt certificates for it. Every time a request is made to mailserver.mydomain.com/.well-known/acme-challenge/[acme-challenge-here], NPM responds with a 404 error.

I have tried curl -H "Host: mailserver.mydomain.com" http://[serverIP]:8080/.well-known/acme-challenge/test and it works fine, but when I try curl mailserver.mydomain.com/.well-known/acme-challenge/test, I get the response of:

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>openresty</center>
</body>
</html>

I can also see this in the NPM logs:

==> ./proxy-host-12_error.log <==
2022/05/31 16:28:25 [error] 479#479: *4286 open() "/data/letsencrypt-acme-challenge/.well-known/acme-challenge/test" failed (2: No such file or directory), client: xx.xxx.xx.xx, server: autoconfig.mydomain.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "mailserver.mydomain.com"

==> ./proxy-host-12_access.log <==
[31/May/2022:16:28:25 +0000] - - 404 - GET http mailserver.mydomain.com "/.well-known/acme-challenge/test" [Client xx.xx.xx.xx] [Length 150] [Gzip -] [Sent-to xx.xx.xx.xx] "curl/7.64.1" "-"

This seems to suggest that maybe NPM is looking for this file locally instead of actually passing the request to my server?

Nginx Proxy Manager Version

v.9.18

Operating System

Ubuntu Server 20.04

Originally created by @lriley2020 on GitHub (May 31, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2085 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> I am running a Mailcow server behind NPM and need to get Letsencrypt certificates for it. Every time a request is made to mailserver.mydomain.com/.well-known/acme-challenge/[acme-challenge-here], NPM responds with a 404 error. I have tried ```curl -H "Host: mailserver.mydomain.com" http://[serverIP]:8080/.well-known/acme-challenge/test``` and it works fine, but when I try ```curl mailserver.mydomain.com/.well-known/acme-challenge/test```, I get the response of: ``` <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>openresty</center> </body> </html> ``` I can also see this in the NPM logs: ``` ==> ./proxy-host-12_error.log <== 2022/05/31 16:28:25 [error] 479#479: *4286 open() "/data/letsencrypt-acme-challenge/.well-known/acme-challenge/test" failed (2: No such file or directory), client: xx.xxx.xx.xx, server: autoconfig.mydomain.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "mailserver.mydomain.com" ==> ./proxy-host-12_access.log <== [31/May/2022:16:28:25 +0000] - - 404 - GET http mailserver.mydomain.com "/.well-known/acme-challenge/test" [Client xx.xx.xx.xx] [Length 150] [Gzip -] [Sent-to xx.xx.xx.xx] "curl/7.64.1" "-" ``` This seems to suggest that maybe NPM is looking for this file locally instead of actually passing the request to my server? **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> v.9.18 **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> Ubuntu Server 20.04
kerem 2026-02-26 07:31:19 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@the1ts commented on GitHub (May 31, 2022):

What you describe is exactly the job of NPM. Its the proxy that creates, renews, uses and holds the certs for the services behind it. To do that it captures the calls to the /.well-known/acme-challenge/.

What may be useful for you to know is the /data/letsencrypt directory on the host holds the certs and keys, so it can be shared between NPM and other containers that need those certs. Leaving NPM to update the certs and other containers to simply use them. For instance, I use the NPM created wildcard cert for email services by pointing exim and dovecot at the NPM certs.

If you need permission changes, other container restarts etc letsencrypt has the ability to run scripts, see the renewal-hooks directory.

<!-- gh-comment-id:1142666049 --> @the1ts commented on GitHub (May 31, 2022): What you describe is exactly the job of NPM. Its the proxy that creates, renews, uses and holds the certs for the services behind it. To do that it captures the calls to the /.well-known/acme-challenge/. What may be useful for you to know is the /data/letsencrypt directory on the host holds the certs and keys, so it can be shared between NPM and other containers that need those certs. Leaving NPM to update the certs and other containers to simply use them. For instance, I use the NPM created wildcard cert for email services by pointing exim and dovecot at the NPM certs. If you need permission changes, other container restarts etc letsencrypt has the ability to run scripts, see the renewal-hooks directory.
Author
Owner

@lriley2020 commented on GitHub (May 31, 2022):

Hi, thanks so much for your advice - I was just thinking about something like that now! It seems like someone else seems to have had my exact same problem in #779, so sorry for not looking throroughly enough! I'll try adding a renewal hook later and close this for now

<!-- gh-comment-id:1142683480 --> @lriley2020 commented on GitHub (May 31, 2022): Hi, thanks so much for your advice - I was just thinking about something like that now! It seems like someone else seems to have had my exact same problem in #779, so sorry for not looking throroughly enough! I'll try adding a renewal hook later and close this for now
Author
Owner

@mxtthiasss commented on GitHub (May 25, 2023):

Hi,
is it just possible to send .well-know part to mailcow?

<!-- gh-comment-id:1563135729 --> @mxtthiasss commented on GitHub (May 25, 2023): Hi, is it just possible to send .well-know part to mailcow?
Author
Owner

@lriley2020 commented on GitHub (May 25, 2023):

There will probably be a way, but I decided not to go down that route because I still want NPM to handle the ACME requests for my other certificates for other services. In the end, it wasn't that hard to just make a posthook script that copies the new certificate from NPM to mailcow when it gets renewed (see #779).

<!-- gh-comment-id:1563551826 --> @lriley2020 commented on GitHub (May 25, 2023): There will probably be a way, but I decided not to go down that route because I still want NPM to handle the ACME requests for my other certificates for other services. In the end, it wasn't that hard to just make a posthook script that copies the new certificate from NPM to mailcow when it gets renewed (see #779).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1501
No description provided.