mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 02:02:26 -04:00
Misc. changes: {hostonly} placeholder, self_signed port fix
This commit is contained in:
parent
32329a473d
commit
227664336e
2
caddy.go
2
caddy.go
@ -93,7 +93,7 @@ func (i *Instance) Stop() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// splice instance list to delete this one
|
// splice i out of instance list, causing it to be garbage-collected
|
||||||
instancesMu.Lock()
|
instancesMu.Lock()
|
||||||
for j, other := range instances {
|
for j, other := range instances {
|
||||||
if other == i {
|
if other == i {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
: ${output_filename:="${1:-}"}
|
: ${output_filename:="${1:-}"}
|
||||||
: ${output_filename:="caddy"}
|
: ${output_filename:=""}
|
||||||
|
|
||||||
: ${git_repo:="${2:-}"}
|
: ${git_repo:="${2:-}"}
|
||||||
: ${git_repo:="."}
|
: ${git_repo:="."}
|
||||||
|
@ -138,7 +138,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) {
|
|||||||
// is incorrect for this site.
|
// is incorrect for this site.
|
||||||
cfg.Addr.Scheme = "https"
|
cfg.Addr.Scheme = "https"
|
||||||
}
|
}
|
||||||
if cfg.Addr.Port == "" && (!cfg.TLS.Manual || cfg.TLS.OnDemand) {
|
if cfg.Addr.Port == "" && ((!cfg.TLS.Manual && !cfg.TLS.SelfSigned) || cfg.TLS.OnDemand) {
|
||||||
// this is vital, otherwise the function call below that
|
// this is vital, otherwise the function call below that
|
||||||
// sets the listener address will use the default port
|
// sets the listener address will use the default port
|
||||||
// instead of 443 because it doesn't know about TLS.
|
// instead of 443 because it doesn't know about TLS.
|
||||||
|
@ -69,7 +69,14 @@ func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Repla
|
|||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
}(),
|
}(),
|
||||||
"{host}": r.Host,
|
"{host}": r.Host,
|
||||||
|
"{hostonly}": func() string {
|
||||||
|
host, _, err := net.SplitHostPort(r.Host)
|
||||||
|
if err != nil {
|
||||||
|
return r.Host
|
||||||
|
}
|
||||||
|
return host
|
||||||
|
}(),
|
||||||
"{path}": r.URL.Path,
|
"{path}": r.URL.Path,
|
||||||
"{path_escaped}": url.QueryEscape(r.URL.Path),
|
"{path_escaped}": url.QueryEscape(r.URL.Path),
|
||||||
"{query}": r.URL.RawQuery,
|
"{query}": r.URL.RawQuery,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user