diff options
author | Matthew Holt <[email protected]> | 2020-03-20 20:25:46 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-03-20 20:25:46 -0600 |
commit | d692d503a3d327d54c82bceab48bb1de07bb3c3d (patch) | |
tree | 82d4442c9188b361fdf20b90a453e6d65a96a80b /context.go | |
parent | 3c1def243020a3897121d4c5badf07ed45d2397d (diff) | |
download | caddy-d692d503a3d327d54c82bceab48bb1de07bb3c3d.tar.gz caddy-d692d503a3d327d54c82bceab48bb1de07bb3c3d.zip |
tls/http: Fix auto-HTTPS logic w/rt default issuers (fixes #3164)
The comments in the code should explain the new logic thoroughly.
The basic problem for the issue was that we were overriding a catch-all
automation policy's explicitly-configured issuer with our own, for names
that we thought looked like public names. In other words, one could
configure an internal issuer for all names, but then our auto HTTPS
would create a new policy for public-looking names that uses the
default ACME issuer, because we assume public<==>ACME and
nonpublic<==>Internal, but that is not always the case. The new logic
still assumes nonpublic<==>Internal (on catch-all policies only), but
no longer assumes that public-looking names always use an ACME issuer.
Also fix a bug where HTTPPort and HTTPSPort from the HTTP app weren't
being carried through to ACME issuers properly. It required a bit of
refactoring.
Diffstat (limited to 'context.go')
-rw-r--r-- | context.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/context.go b/context.go index 9eb677bf8..5c8df51bb 100644 --- a/context.go +++ b/context.go @@ -377,9 +377,14 @@ func (ctx Context) loadModuleInline(moduleNameKey, moduleScope string, raw json. return val, nil } -// App returns the configured app named name. If no app with -// that name is currently configured, a new empty one will be -// instantiated. (The app module must still be registered.) +// App returns the configured app named name. If that app has +// not yet been loaded and provisioned, it will be immediately +// loaded and provisioned. If no app with that name is +// configured, a new empty one will be instantiated instead. +// (The app module must still be registered.) This must not be +// called during the Provision/Validate phase to reference a +// module's own host app (since the parent app module is still +// in the process of being provisioned, it is not yet ready). func (ctx Context) App(name string) (interface{}, error) { if app, ok := ctx.cfg.apps[name]; ok { return app, nil |