From 89f93362c25c3f5b682f6f072eb44af3f62a808d Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 2 Aug 2021 16:40:23 -0400 Subject: [PATCH 1/2] httpcaddyfile: Add shortcut for proxy hostport placeholder I've noticed that it's a pretty common pattern to write a proxy like this, when needing to proxy over HTTPS: ``` reverse_proxy https://example.com { header_up Host {http.reverse_proxy.upstream.hostport} } ``` I find it pretty hard to remember the exact placeholder to use for this, and I continually need to refer to the docs when I need it. I think a simple fix for this is to add another Caddyfile placeholder for this one to shorten it: ``` reverse_proxy https://example.com { header_up Host {proxy_hostport} } ``` --- caddyconfig/httpcaddyfile/httptype.go | 1 + 1 file changed, 1 insertion(+) diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 2a11f85e5cf..cb9e7f115b7 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -113,6 +113,7 @@ func (st ServerType) Setup(inputServerBlocks []caddyfile.ServerBlock, "{tls_client_serial}", "{http.request.tls.client.serial}", "{tls_client_subject}", "{http.request.tls.client.subject}", "{tls_client_certificate_pem}", "{http.request.tls.client.certificate_pem}", + "{proxy_hostport}", "{http.reverse_proxy.upstream.hostport}", ) // these are placeholders that allow a user-defined final From e1dd31d1f66aa425fff7602c5d37bdf9158597dc Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 2 Aug 2021 23:57:12 -0400 Subject: [PATCH 2/2] Switch the shortcut name --- caddyconfig/httpcaddyfile/httptype.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index cb9e7f115b7..ff52dbf9f3e 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -113,7 +113,7 @@ func (st ServerType) Setup(inputServerBlocks []caddyfile.ServerBlock, "{tls_client_serial}", "{http.request.tls.client.serial}", "{tls_client_subject}", "{http.request.tls.client.subject}", "{tls_client_certificate_pem}", "{http.request.tls.client.certificate_pem}", - "{proxy_hostport}", "{http.reverse_proxy.upstream.hostport}", + "{upstream_hostport}", "{http.reverse_proxy.upstream.hostport}", ) // these are placeholders that allow a user-defined final