Skip to content

Commit 2e0ef39

Browse files
committed
don't check for the len of hosts when evaluating the TLSOnDemandUrl
1 parent f91ed90 commit 2e0ef39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/server/service.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ func (s *Service) createCertManager(hosts []string, options ServiceOptions) (Cer
337337
}
338338

339339
func (s *Service) createAutoCertHostPolicy(hosts []string, options ServiceOptions) (autocert.HostPolicy, error) {
340-
onDemandTls := len(hosts) == 0 && options.TLSOnDemandUrl != ""
340+
slog.Info("createAutoCertHostPolicy called", options.TLSOnDemandUrl, len(hosts), "🚨", "ok")
341341

342-
if !onDemandTls {
342+
if options.TLSOnDemandUrl == "" {
343343
return autocert.HostWhitelist(hosts...), nil
344344
}
345345

@@ -350,7 +350,11 @@ func (s *Service) createAutoCertHostPolicy(hosts []string, options ServiceOption
350350
return nil, err
351351
}
352352

353+
slog.Info("Will use the tls_on_demand_url URL")
354+
353355
return func(ctx context.Context, host string) error {
356+
slog.Info("Get a certificate for", host, "🤞")
357+
354358
resp, err := http.Get(fmt.Sprintf("%s?host=%s", options.TLSOnDemandUrl, url.QueryEscape(host)))
355359

356360
if err != nil {

0 commit comments

Comments
 (0)