Skip to content

autohttps: Ensure CertMagic config is recreated after autohttps runs - #7510

Merged
mholt merged 1 commit into
masterfrom
reliable-certmagic-provision
Mar 3, 2026
Merged

mholt merged 1 commit into
masterfrom
reliable-certmagic-provision

Conversation

@francislavoie

Copy link
Copy Markdown
Member

Context: https://caddy.community/t/80-bind-error-when-starting-with-tls-internal/33491

Auto-HTTPS was setting the port "too late" after the issuer was provisioned so the CertMagic config was already created with the wrong AltHTTPPort. This way, it will reconfigure CertMagic afterwards to ensure it's all good.

Assistance Disclosure

Used a long session with Github Copilot to figure out what was going wrong, used it to apply the fix then I polished it and tested it by hand.

@francislavoie
francislavoie requested a review from mholt February 21, 2026 22:00
@francislavoie francislavoie added the bug 🐞 Something isn't working label Feb 21, 2026
@francislavoie francislavoie added this to the v2.11.2 milestone Feb 21, 2026

@mholt mholt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Francis.

Man, the auto-HTTPS stuff feels more and more hacky as the years go on. I wonder if I need to sit down and rethink this at some point. Like it seems like we have to do quite a few things a second time, or there's lots of circularity in the code. Anyway, that's a topic for another time.

@mholt
mholt merged commit d935a69 into master Mar 3, 2026
30 checks passed
@mholt
mholt deleted the reliable-certmagic-provision branch March 3, 2026 21:44
@github-actions github-actions Bot mentioned this pull request Mar 6, 2026
4 tasks
steadytao pushed a commit that referenced this pull request Oct 28, 2026
* caddytls: keep ACME issuer network proxy across re-provisioning

LoadModule clears NetworkProxyRaw, so when the HTTP app provisions an
ACME issuer a second time (fillInACMEIssuer), the rebuilt template has
no HTTPProxy. Since #7510 that template is used via SetConfig, and ACME
requests bypass the configured proxy.

Keep the loaded proxy func on the issuer, like the DNS solver.

Fixes #8283

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2366825f2380383dacd8adeb1508e34c3e25634d)

* caddytls: test that ACME requests use the proxy after RebuildCertMagic

Replace the provision-twice check with a regression for the path the
HTTP app takes: Provision, re-provision in fillInACMEIssuer, then
RebuildCertMagic. The test issues against a local proxy and asserts the
ACME request goes through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: k4lleanka <257361691+k4lleanka@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants