summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-07-01 17:20:51 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2021-07-01 17:20:51 -0600
commit0bdb8aa82d7cef64dae3f75f19c680922237e658 (patch)
treebb9e9ee0ed5dd1e32ccf2b7110273d8bf4df0e69 /modules
parent191dc86f9e40c12517a133cf2181631c9adec791 (diff)
acmeserver: Don't set host for directory links by default
This makes the server more easily proxied.
Diffstat (limited to 'modules')
-rw-r--r--modules/caddypki/acmeserver/acmeserver.go19
1 files changed, 6 insertions, 13 deletions
diff --git a/modules/caddypki/acmeserver/acmeserver.go b/modules/caddypki/acmeserver/acmeserver.go
index 7f9195e..42d8cc4 100644
--- a/modules/caddypki/acmeserver/acmeserver.go
+++ b/modules/caddypki/acmeserver/acmeserver.go
@@ -50,17 +50,16 @@ type Handler struct {
// The hostname or IP address by which ACME clients
// will access the server. This is used to populate
- // the ACME directory endpoint. Default: localhost.
+ // the ACME directory endpoint. If not set, the Host
+ // header of the request will be used.
// COMPATIBILITY NOTE / TODO: This property may go away in the
- // future, as it is currently only required due to
- // limitations in the underlying library. Do not rely
- // on this property long-term; check release notes.
+ // future. Do not rely on this property long-term; check release notes.
Host string `json:"host,omitempty"`
// The path prefix under which to serve all ACME
// endpoints. All other requests will not be served
// by this handler and will be passed through to
- // the next one. Default: "/acme/"
+ // the next one. Default: "/acme/".
// COMPATIBILITY NOTE / TODO: This property may go away in the
// future, as it is currently only required due to
// limitations in the underlying library. Do not rely
@@ -93,9 +92,6 @@ func (ash *Handler) Provision(ctx caddy.Context) error {
if ash.CA == "" {
ash.CA = caddypki.DefaultCAID
}
- if ash.Host == "" {
- ash.Host = defaultHost
- }
if ash.PathPrefix == "" {
ash.PathPrefix = defaultPathPrefix
}
@@ -151,7 +147,7 @@ func (ash *Handler) Provision(ctx caddy.Context) error {
acmeRouterHandler := acmeAPI.NewHandler(acmeAPI.HandlerOptions{
CA: auth,
DB: acmeDB, // stores all the server state
- DNS: ash.Host, // used for directory links; TODO: not needed (follow-up upstream with step-ca)
+ DNS: ash.Host, // used for directory links
Prefix: strings.Trim(ash.PathPrefix, "/"), // used for directory links
})
@@ -219,10 +215,7 @@ func (ash Handler) openDatabase() (*db.AuthDB, error) {
return database.(databaseCloser).DB, err
}
-const (
- defaultHost = "localhost"
- defaultPathPrefix = "/acme/"
-)
+const defaultPathPrefix = "/acme/"
var keyCleaner = regexp.MustCompile(`[^\w.-_]`)
var databasePool = caddy.NewUsagePool()