nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Update force-ssl.conf to allow for letsencrypt directories over http

Open the1ts opened this issue 2 years ago • 20 comments

Since we have moved force-ssl.conf into the server section, it overrides the location based letsencrypt allowed over http

  • Make force-ssl only work if both http traffic and outside the letsencrypt directories.
  • Fixes #1625

the1ts avatar May 04 '22 16:05 the1ts

This is an automated message from CI:

Docker Image for build 1 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-2038

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

jc21 avatar May 04 '22 16:05 jc21

Not the best candidate to test this since I'm using a DNS based wildcard so letsencrypt not hitting Nginx. However, I'm not seeing issues for http->https on my domains. And curl to the /.well-known/acme-challenge/1234 gives the expected 404 rather than 301 redirect and I have made no changes so have both old and new style config with force-ssl.conf in both server section and location / section.

the1ts avatar May 05 '22 11:05 the1ts

Just a bump, we are blocking renews.

the1ts avatar Jun 03 '22 20:06 the1ts

Another bump. I have the same problem and have to manually unforce ssl and then renew the ssl certificate.

arsors avatar Jul 11 '22 09:07 arsors

@jc21 I appreciate you're looking hard at 3.0, but please take a look at this pr, this is blocking renewals of newly created proxies (from those made after the force_ssl.conf move to server section) which isn't a good look for us to have in the version 2 branch.

the1ts avatar Jul 22 '22 10:07 the1ts

Bumping this, renewals are still broken as far as I can tell.

tfmm avatar Sep 07 '22 13:09 tfmm

Bump, why is this not priority, I can only assume that nobody maintains this anymore

maltokyo avatar Oct 03 '22 21:10 maltokyo

@maltokyo all I would ask is if you can move to using the docker image mentioned in comment 2 here. That has the fix and it would be good to see some confirmation here. You must remember to move back to :latest when this project starts moving again so you don't get stuck on an old version.

the1ts avatar Oct 04 '22 12:10 the1ts

Thank you @the1ts - I am on the latest version, so hesitate to move back to a version from May. Can I apply the fix myself, build and test this way?

maltokyo avatar Oct 04 '22 19:10 maltokyo

@maltokyo latest is from March, so older than the fixed one in this PR.

the1ts avatar Oct 04 '22 19:10 the1ts

Ah apologies! Will try this, thank you @the1ts

maltokyo avatar Oct 04 '22 23:10 maltokyo

@the1ts do I need to worry about the warning: "Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes"

I dont see db changes in this PR itself, but just wanted to check. Backing up will take some time for me.

maltokyo avatar Oct 05 '22 09:10 maltokyo

@maltokyo the only changes are to nginx file creation not DB. So change the docker tag and try and get npm to make a change to the nginx files by perhaps turning off and on the force SSL. Then renewal should be back working next time it's needed.

the1ts avatar Oct 05 '22 10:10 the1ts

ok, running it now, will leave for some time and see what happens. Unfortunately, next renewals are on 1st Jan, so might need to wait.

maltokyo avatar Oct 05 '22 10:10 maltokyo

@the1ts @jc21 OK I tried the version in jc21/nginx-proxy-manager:github-pr-2038 and confirm it correctly allows manual renewal via the UI (/nginx/certificates page) for proxies that have 'Force SSL' enabled.

(I did have an issue at first where I was getting an internal error but clearing the certbot lock files as per this post did the trick!)

EDIflyer avatar Oct 07 '22 10:10 EDIflyer

Great to see a new release out but would be great if this PR could be merged in so I could pick up those updates too :)

EDIflyer avatar Nov 08 '22 17:11 EDIflyer

It's really a pain right now to manually renew all certificates that have "force ssl" enabled. That's a key function of nginx proxy manager and I am considering to unuse it just because of that bug... I have 15 domains and to update all manually is a real pain! That bug is existing since a year @jc21

Schlumpf9 avatar Nov 11 '22 08:11 Schlumpf9

As a fix seems to be available now...when will this be added to the official release?

Thank you very much. :)

fdzaebel avatar Nov 25 '22 11:11 fdzaebel

ok, running it now, will leave for some time and see what happens. Unfortunately, next renewals are on 1st Jan, so might need to wait.

@the1ts - I have been running the version specified as above, and my certificates expire on Jan 1st 2023, and have NOT been auto-updated while running this version. They should have been by now, correct? If that is the case, I suppose this fix is not working out.

maltokyo avatar Dec 27 '22 12:12 maltokyo

Sorry @maltokyo I don't use NPM anymore as its not really been supported for most of a year, but I would check out issue #918 others have seen issues with lock files being left behind that stop certbot from actually running even after this fix for force ssl. You can force an update in the UI and look at both certbot logs and NPM for more info.

the1ts avatar Dec 27 '22 19:12 the1ts

IMHO the regexp in the commit needs additional escaping:

- if ($request_uri !~ "^/.well-known/acme-challenge/(.*)") {
+ if ($request_uri !~ "^/\.well-known/acme-challenge/(.*)") {

Also an alternative implementation of force-ssl.conf could be:

set $url "${scheme}:${request_uri}";
if ($url ~ "^http:(?!/\.well-known/acme-challenge/(.*))") {
        return 301 https://$host$request_uri;
}

Whoopsadaisy avatar Jan 05 '23 22:01 Whoopsadaisy

thanks @the1ts - what do you use now? maybe time to switch, cant be chasing basic stuff like this for months and months.

maltokyo avatar Jan 11 '23 21:01 maltokyo

Docker Image for build 7 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-2038

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

Any chance this PR could be rebased onto the current version?

EDIflyer avatar Mar 31 '23 06:03 EDIflyer

Sorry, but I need to say my enthusiasm for NPM...

sanderlv avatar Apr 01 '23 18:04 sanderlv

Bump! Still an issue in 2.10.4! @jc21 PLEASE MERGE THIS PR!

Forget it... Merge #3121

KaeTuuN avatar Dec 11 '23 20:12 KaeTuuN

+1, please merge #3121 @jc21

sunsreddit avatar Jan 13 '24 16:01 sunsreddit