Dial addresses must be only a host and port. The https:// bit is Caddyfile sugar for enabling the tls option (if using the http transport). Your placeholder is being used at runtime, so that skips right past the Caddyfile’s logic.
So you’ll need to make your request ?proxyTarget=myhost.com:443
This seems ripe for abuse though. I think you should set up a whitelist for the allowed values
FYI re query matcher, I found a bug with it yesterday, so you may need to wait for v2.3.0 to properly whitelist with a query matcher:
I used xcaddy with commit: c9fdff9
And I still have a problem. It looks like a colon : is being inserted unless I use a colon between two placeholders but if a colon exists within a placeholder another is added before the dial.
making dial info: upstream {http.scheme}{http.host}{http.port}:: invalid dial address https://github.com:443:: address /github.com:443:: too many colons in address
Well, you can’t have the scheme; that’s one thing. The scheme is a Caddyfile-only shortcut to enable the tls field in the JSON. Caddy isn’t equipped to proxy to HTTP or HTTPS dynamically, it’s either or.
That said, I don’t know where the :: is coming from, that doesn’t make sense
Yes, Caddyfile will add :443 if there’s no port, I think, if you specify https://. But you can easily verify by using caddy adapt and looking at the output.