Closed polarathene closed 8 months ago
Can you share your full config? You only showed global options, but the actual site blocks affect the result of servers
. Just so we're on the same page.
It sounds to me like a logic error that you use PROXY protocol and are sending both HTTP and HTTPS to the same port. That implies you have a proxy in front of Caddy, so that proxy should be configured to never do that.
The point of http_redirect
is mainly for users who want to serve TLS on non-standard ports, because then when you type that port in your browser address bar like example.com:8443
the browser will try HTTP first because you didn't specify a scheme. So the listener detects that case and serves a redirect to https://example.com:8443
to "fix" it.
Not sure why, but proxy_protocol has two entries listed (JSON docs for listener_wrappers) with one marked as non-standard:
That's because it used to only be available as a plugin before 2.7.0, but we've since bundled it with Caddy because we wanted to add PROXY protocol support to reverse_proxy
's HTTP transport. We just forgot to unlist the old plugin I guess. We can do that (FYI @mholt).
The PROXY protocol links point to docs location from HAProxy 1.8 release (that seems to have been updated since) but should probably reference a more direct source?: haproxy/haproxy@master/doc/proxy-protocol.txt
Good point, updated. But anyway, the documents aren't materially different, looks like there was just a tiny fix regarding the byte format but that's not relevant to users, only relevant to library authors.
proxy_protocol
could better clarify allow expectations (suggestion provided below), possibly improve implementation.
I assume you're using v2.7.6, right? We're using an older PROXY protocol implementation in that version, and we've merged a change in https://github.com/caddyserver/caddy/pull/5915 to use a different library, which will release with v2.8.0
Do you mind trying a build from master
to see if it works as you'd expect?
Can you share your full config? You only showed global options, but the actual site blocks affect the result of
servers
. Just so we're on the same page.
The Caddyfile was rather simple, beyond the global config (and using local_certs
):
# Technically when http:// was active it was a separate site block with different respond text to avoid any confusion
#http://example.test {
example.test {
log
respond "hello world!"
}
http://
as described above while troubleshooting.Curl commands:
# With Traefik
# --resolve adds entries to reroute FQDN:port through Traefik IP instead of direct connection to Caddy
# -k / --insecure because of container boundaries adding friction to the local cert trust.
# This has both ports configured to test:
# - HTTP => HTTPS working (handled by Caddy)
# - PROXY protocol (handled between Traefik => Caddy)
# Additionally without redirect, that Traefik successfully routes and connects HTTP / HTTPS to equivalent site blocks in Caddy
$ curl -vk --resolve example.test:80:172.16.42.10 --resolve example.test:443:172.16.42.10 http://example.test
# Direct to Caddy:
$ curl http://example.test
$ curl https://example.test
# Only for investigating concerns related to http_redirect feature:
# Not really relevant to Traefik
$ curl http://example.test:443
Client sent an HTTP request to an HTTPS server.
I can provide a proper compose.yaml
reproduction with Traefik config if interested. It'll have to wait until tomorrow as it's late here.
It sounds to me like a logic error that you use PROXY protocol and are sending both HTTP and HTTPS to the same port. That implies you have a proxy in front of Caddy, so that proxy should be configured to never do that.
With the bug described above (no separate http://
block), for clarity:
proxy_protocol
would be handled? Whereas if the PROXY header information was present Caddy shows nothing in logs and Traefik responds with 400 Bad Request
.http://
block, but to get back the redirect to HTTPS... Caddy needed listener_wrappers
to have http_redirect
added explicitly after proxy_protocol
. If http_redirect
was placed prior, it didn't do anything and the regular HTTP respond
directive was returned.The point of
http_redirect
is mainly for users who want to serve TLS on non-standard ports, because then when you type that port in your browser address bar likeexample.com:8443
the browser will try HTTP first because you didn't specify a scheme. So the listener detects that case and serves a redirect tohttps://example.com:8443
to "fix" it.
I understand, and the docs could probably convey that intent better.
Presently they imply the feature redirects in a manner that's contradicting if it's http://
to the HTTP port (as defined by Caddy with default port 80). That should technically be a no-op?
I understand that I would need to specify two separate servers
config here otherwise. I'm just documenting the concern as a workaround to the actual bug since http://example.test:80
was not receiving an implicit redirect like it should have by default (with no http://
block in Caddyfile), this was only breaking when the PROXY protocol header was present.
Whereas a TLS / HTTPS connection worked fine with the PROXY protocol header. Plain HTTP works too when the implicit redirect feature isn't there, so that seems like a bug?
The PROXY protocol links point to docs location from HAProxy 1.8 release (that seems to have been updated since) but should probably reference a more direct source?: haproxy/haproxy@master/doc/proxy-protocol.txt
Good point, updated. But anyway, the documents aren't materially different, looks like there was just a tiny fix regarding the byte format but that's not relevant to users, only relevant to library authors.
I understand. It may change if there is an update sometime in the future and the 1.8 docs aren't refreshed with that update though π€·ββοΈ I figure the github source is more appropriate π
I'm not a library author but I didn't know anything about it until a week ago, there had been various issues from users with setting up PROXY protocol correctly with Traefik and other maintainers not knowing what the support status was with software we needed to use it with (neither documented v2 support IIRC, while our own prior community contributed docs had mixed versioning). I still found the spec useful :)
proxy_protocol
could better clarify allow expectations (suggestion provided below), possibly improve implementation.I assume you're using v2.7.6, right? We're using an older PROXY protocol implementation in that version, and we've merged a change in caddyserver/caddy#5915 to use a different library, which will release with v2.8.0
Do you mind trying a build from
master
to see if it works as you'd expect?
Yes 2.7.6.
I can do a build tomorrow and get back to you π
I added the
http://
as described above while troubleshooting.
So the thing is, the servers
global option with no arguments applies to all listeners produced by site blocks in your Caddyfile. If you have just a site with no scheme, then it's a :443
server. But if you add an http://
site block, then it will always apply to the :80
server. Use caddy adapt -p
to see what it produces.
Basically if you're using the tls
listener wrapper, you should explicitly configure servers :443
and not just servers
so it doesn't accidentally apply to your :80
server as well.
Presently they imply the feature redirects in a manner that's contradicting if it's
http://
to the HTTP port (as defined by Caddy with default port 80). That should technically be a no-op?
I'm not sure I follow, but it's definitely wrong to enable the http_redirect
listener wrapper on an :80
server, because then it would prevent things like the ACME HTTP challenge from working (because it would redirect before the HTTP handlers get a chance to run).
Similarly, it doesn't really make sense to enable PROXY protocol on the :80
server because there's no real value in knowing the real client IP when the result is redirecting to HTTPS and not reaching the app.
Basically if you're using the
tls
listener wrapper, you should explicitly configureservers :443
and not justservers
so it doesn't accidentally apply to your:80
server as well.I'm not sure I follow, but it's definitely wrong to enable the
http_redirect
listener wrapper on an:80
server, because then it would prevent things like the ACME HTTP challenge from working (because it would redirect before the HTTP handlers get a chance to run).
I don't actually want the http://
,
auto_https
implicit redirect behaviour breaking when proxy_protocol
is in use.http_redirect
is needed, But docs should probably clarify that it should come after proxy_protocol
when both are present, as per the summary bullet points.http_redirect
+ http://
was only to confirm that the functionality was working (HTTP => HTTPS) with proxy_protocol
when configured explicitly. So the incompatibility was with implicit logic.We'll see if the 2.8 build tomorrow is any different there.
Regarding the ACME example and the quote, http_redirect
should logically not apply if the scheme is http://
and the port is 80
? (_or rather http_port
_) but it does.
Similarly, it doesn't really make sense to enable PROXY protocol on the
:80
server because there's no real value in knowing the real client IP when the result is redirecting to HTTPS and not reaching the app.
It wasn't about if it made sense. Just identifying inconsistent in behaviour with connections when PROXY protocol is enabled or not. It should not break the default implicit redirect functionality.
example.test {
respond "test"
}
That should redirect http to https when PROXY protocol is enabled, it doesn't.
No
http_redirect
is needed, But docs should probably clarify that it should come afterproxy_protocol
when both are present, as per the summary bullet points.
I think I'd rather just document that they shouldn't be used together. There's not really any situation where it makes sense to have both.
Regarding the ACME example and the quote,
http_redirect
should logically not apply if the scheme ishttp://
and the port is80
? (or rather http_port) but it does.
Moreso, it shouldn't be configured on :80
. It's not designed to be "smart", it's designed to be a "dumb" redirect.
That should redirect http to https when PROXY protocol is enabled, it doesn't.
So you're saying that curl -v http://example.com
with that config + PROXY protocol listener wrapped enabled does not show Location: https://example.com/
? Yeah that's probably a bug if that's the case, but I have no idea why that would happen. Debug level logs (or just the curl
output) might show something interesting. If proven, an issue should be open on the main Caddy repo.
Built Caddy 2.8 as shown in config below.
http://
or similar declaration in Caddyfile:
http_redirect
before proxy_protocol
.go-proxyproto
is an improvement (Same package as what Traefik uses). Now a port can accept traffic with/without PROXY protocol from the same host :+1:I'll trim the below example to bare minimal for demonstrating the bug in Caddy 2.8 and open an issue with that if you'd like?
So you're saying that
curl -v http://example.com
with that config + PROXY protocol listener wrapped enabled does not showLocation: https://example.com/
?
Yes.
# Start the Traefik and Caddy containers:
$ docker compose up -d --force-recreate
# Get a shell into the client container for manual commands:
$ docker compose run --rm client ash
# Route to Caddy through Traefik TCP router with PROXY protocol:
$ curl --verbose --connect-to ::traefik.internal.test http://example.test
* Connecting to hostname: traefik.internal.test
* Host traefik.internal.test:80 was resolved.
* IPv6: (none)
* IPv4: 172.16.42.10
* Trying 172.16.42.10:80...
* Connected to traefik.internal.test (172.16.42.10) port 80
> GET / HTTP/1.1
> Host: example.test
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain; charset=utf-8
< Connection: close
<
* Closing connection
400 Bad Request
# Direct to Caddy:
$ curl --verbose --connect-to ::caddy.internal.test http://example.test
* Connecting to hostname: caddy.internal.test
* Host caddy.internal.test:80 was resolved.
* IPv6: (none)
* IPv4: 172.16.42.20
* Trying 172.16.42.20:80...
* Connected to caddy.internal.test (172.16.42.20) port 80
> GET / HTTP/1.1
> Host: example.test
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://example.test/
< Server: Caddy
< Date: Tue, 13 Feb 2024 08:22:02 GMT
< Content-Length: 0
<
* Closing connection
In the previous comment, comment out this TCP non-TLS service to disable PROXY protocol usage:
- traefik.tcp.services.web.loadbalancer.proxyProtocol.version=2
Run the same curl command again:
$ curl --verbose --connect-to ::traefik.internal.test http://example.test
* Connecting to hostname: traefik.internal.test
* Host traefik.internal.test:80 was resolved.
* IPv6: (none)
* IPv4: 172.16.42.10
* Trying 172.16.42.10:80...
* Connected to traefik.internal.test (172.16.42.10) port 80
> GET / HTTP/1.1
> Host: example.test
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://example.test/
< Server: Caddy
< Date: Tue, 13 Feb 2024 08:23:30 GMT
< Content-Length: 0
<
* Closing connection
Issue is related to PROXY protocol header.
Alternatively, enable PROXY protocol again for the TCP non-TLS service; Then uncomment the Caddyfile entry for http://http-only.test
:
http://http-only.test {
import respond_with "HTTP without redirect"
}
Ignore that site address, just try connect to http://example.test
again:
$ curl --verbose --connect-to ::traefik.internal.test http://example.test
* Connecting to hostname: traefik.internal.test
* Host traefik.internal.test:80 was resolved.
* IPv6: (none)
* IPv4: 172.16.42.10
* Trying 172.16.42.10:80...
* Connected to traefik.internal.test (172.16.42.10) port 80
> GET / HTTP/1.1
> Host: example.test
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://example.test/
< Server: Caddy
< Date: Tue, 13 Feb 2024 08:29:19 GMT
< Content-Length: 0
<
* Closing connection
You can see that it works too.
Yeah that's probably a bug if that's the case, but I have no idea why that would happen.
Something to do with that change and/or PROXY protocol header interaction with the default implicit HTTP => HTTPS redirect?
Observed bug still occurs. Caddy must have an http:// or similar declaration in Caddyfile: Otherwise the implicit redirect on port 80 is presently incompatible with PROXY protocol.
Okay so you're saying that you're sending PROXY protocol to port 80, while having only configured an HTTPS site? Yes, it's expected that this would fail as-is.
As noted in the docs (e.g. https://caddyserver.com/docs/caddyfile/options#name), the HTTP server is only created after the fact by Automatic HTTPS. There's no way for it to guess that it should have enabled PROXY protocol. A user could just as easily only be using PROXY protocol for port 443 and not port 80, so assuming that and copying over the listener wrapper automatically or whatever, would be a flaky assumption I think.
So I think there's no bug here, seems to be working as intended.
Okay so you're saying that you're sending PROXY protocol to port 80, while having only configured an HTTPS site? Yes, it's expected that this would fail as-is.
Then why doesn't it fail when I connect to port 80 without PROXY protocol? π
As noted in the docs (e.g. https://caddyserver.com/docs/caddyfile/options#name), the HTTP server is only created after the fact by Automatic HTTPS. There's no way for it to guess that it should have enabled PROXY protocol.
Okay, I think that docs could be explained better. I read through it several times and still wasn't quite sure how to grok the admonition as it uses name
for both 443 and 80, while only stating you need to add a http://
/ :80
site block too:
Those docs could better explain:
servers
config in Caddyfile only adapts to JSON by port (implicit or explicit in servers
) when a port is explicitly used as a site address block (eg: http://
/ :80
).:80
server if one was not adapted to JSON from an explicit http://
/ :80
site block. Despite the docs focus on losing the name
attribute, it's rather than entire servers
block is ignored without that explicit site block to adapt it to JSON (servers
doesn't need to define an explicit :80
, that was only to demonstrate name
working).I didn't care about the server name, nor was that immediately apparent in logic for me to grok that I'd probably have missed what it was explaining. That information should probably be pulled out to the main servers
description, or at the very least for proxy_protocol
section to raise awareness on where it's going to have the most likely amount of friction/confusion similar to name
probably did.
A user could just as easily only be using PROXY protocol for port 443 and not port 80, so assuming that and copying over the listener wrapper automatically or whatever, would be a flaky assumption I think.
No, my understanding was that if I define servers
without an explicit port, it configures proxy_protocol
for all ports/servers.
If I only wanted it on one port, I would be explicit with servers
(which as discovered, doesn't matter unless an explicit site block uses that port).
At least now I know that the implicit :80
listener wasn't getting proxy_protocol
from servers
, and that I had to add an http:// {}
hint to provide an explicit :80
listener. That's where the UX issue was.
So I think there's no bug here, seems to be working as intended.
Agreed not a bug, but still a docs issue.
Not exactly specific to proxy_protocol
, and I don't know how often someone would encounter that but not a fun one to troubleshoot π
I had figured it was related to the servers
config and Automatic HTTPS, hence the exploration with http_redirect
. Maybe the issue is relevant elsewhere, or might be in future settings/features...
That needs a disclaimer not hidden under name
regarding the expectation of a site block using servers
config, an explicit port in servers
alone is not sufficient. Excluding a port to rely on implicit defaults is probably only relevant to :80
with Automatic HTTPS, but should probably draw attention to that too.
name
and proxy_protocol
sections could then link a reference to that for added awareness/troubleshooting.
Then why doesn't it fail when I connect to port 80 without PROXY protocol? π
Why would it? You're just making a simple HTTP request to a simple HTTP server.
If you send PROXY protocol to a simple HTTP server, then it won't be happy because it didn't see HTTP, it saw the PROXY preamble.
Okay, I think that docs could be explained better.
It's a really difficult concept to explain. It requires a grasp of all these things:
servers
, and since this is "hidden" by site addresses, it's not obvious:80
server that didn't exist at Caddyfile adapt timeservers
are applied at Caddyfile adapt time, after parsing sites, but before adapting to JSONservers
doesn't apply to :80
unless http:// { }
is added.You might say "but if servers
is used and auto-https is configured, just always produce a dummy :80
in the Caddyfile adapter" but that's not a valid assumption because listener wrappers for :443
cannot work for :80
(the tls
listener wrapper should not be used on :80
for example). It really has to be explicitly configured by the user, more implicit behaviour won't be better.
But anyway, yes this note shouldn't be only in the name
part. It was just that the first person who ran into this confusing quirk had it happen when they were trying to use name
, but it applies in general to the whole concept of servers
due to auto-https etc. So yes that explanation should be hoisted up.
But still... it's so much to explain, and we don't want the docs to exhaust readers, so it needs to be presented in a sensible way, and I'm having trouble resolving those competing requirements.
To be clear - the docs will change, I'm working on it. But it'll take time to find the right approach.
Why would it? You're just making a simple HTTP request to a simple HTTP server.
Sorry, I forgot to go backwards and edit that away.
I was asking that on the assumption that I had :80
implicitly configured for proxy_protocol
, and that adding http://
site block resolved the incompatibility in some way that wasn't apparent to me beyond how Automatic HTTPS was working behind the scenes.
That's now understood that my servers
config was ignored and only applying to https://
/ :443
since that's all I had implicitly defined in site blocks until I added an explicit http://
π
It's a really difficult concept to explain.
[!WARNING]
servers
configuration only applies to site addresses explicitly defined- Automatic HTTPS provides an implicit
servers :80
configuration unless your Caddyfile explicitly has ahttp://
or:80
site address defined with a matchingservers
configuration (:80
may be explicit or implicit`)
Could do with some revision but that already conveys the issue more clearly to the reader, without being hidden under servers.name
?
Doesn't need to explain the technical details regarding adapting the Caddyfile to JSON, just that expectation/requirement of servers
only being valid/retained when an explicit site address would use it.
You might say "but if
servers
is used and auto-https is configured, just always produce a dummy:80
in the Caddyfile adapter" but that's not a valid assumption because listener wrappers for:443
cannot work for:80
(thetls
listener wrapper should not be used on:80
for example). It really has to be explicitly configured by the user, more implicit behaviour won't be better.
While I'm sure you're correct about that, it does work regardless with tls
listener wrapper on :80
. I guess the scheme detection is the only differentiator for why HTTP vs HTTPS still works with curl.
Someone interested in proxy_protocol
may very well from the current docs, just setup servers
like I did and either already have an http://
/ :80
site block, or adds one to resolve the observed "bug". As you've mentioned, there's quite a lot going on and that confusion is only going to impact a user more who lacks the working knowledge you have.
But still... it's so much to explain, and we don't want the docs to exhaust readers, so it needs to be presented in a sensible way, and I'm having trouble resolving those competing requirements.
While it's not ideal, when I have this issue for the docs I maintain, niche concerns with a lot of technical details usually get placed in collapsed admonitions, or I link to a Github issue comment/thread for more info/insights.
Here is an example for IPv6 docker config:
That's already quite a bit on it's own, but neatly organizes alternative config via tabs and collapses more niche info.
Above that part is an example of where I link to a Github comment for more info:
For reference, recently revised PROXY protocol docs page (unreleased, so this link may eventually become broken for future readers). Quite a lot there is hidden away with the primary focus on the Traefik and related config to use PROXY protocol to preserve the client IP where needed.
To be clear - the docs will change, I'm working on it. But it'll take time to find the right approach.
No worries, I understand π Writing/improving docs is a time consuming effort for me too π
I just wanted to raise awareness and clear up some confusion, which you've been extremely helpful with! β€οΈ
Could do with some revision but that already conveys the issue more clearly to the reader, without being hidden under servers.name?
Doesn't need to explain the technical details regarding adapting the Caddyfile to JSON, just that expectation/requirement of servers only being valid/retained when an explicit site address would use it.
Hmm yeah, I guess so. I'll play with that, thanks.
While I'm sure you're correct about that, it does work regardless with
tls
listener wrapper on:80
. I guess the scheme detection is the only differentiator for why HTTP vs HTTPS still works with curl.
Oh right :man_facepalming: I keep forgetting that the tls
LW is only a placeholder (aka ordering/positioning marker) and it doesn't actually do anything on its own. It only causes TLS to happen on a TLS-enabled server, and on a non-TLS server, it's a no-op. So yeah I guess it's fine if it's set on an HTTP server. I'll add a note of that in the docs.
While it's not ideal, when I have this issue for the docs I maintain, niche concerns with a lot of technical details usually get placed in collapsed admonitions
The issue is our docs right now are pure markdown (with some sprinkled in jquery for targeted augmentations), so we don't have the infra for collapsibles right now. I did set up a tab box with AlpineJS for this one section https://caddyserver.com/docs/running#local-https-with-docker but I haven't gotten around to using this in more places yet (we will though). I'll need to set up the stuff for collapsibles with AlpineJS too eventually.
No worries, I understand π Writing/improving docs is a time consuming effort for me too π
I just wanted to raise awareness and clear up some confusion, which you've been extremely helpful with! β€οΈ
π«Ά
The issue is our docs right now are pure markdown (with some sprinkled in jquery for targeted augmentations)
The docs I reference are generated from markdown as well (mkdocs-material
). There is just some additional syntax their parser understands for features like admonitions and tabs. It's common to see in quite a few docs platforms with markdown as the source format.
You should be able to use HTML usually, and can add <details>
+ <summary>
like I have done in earlier comments above for collapsed sections. Just for actual docs you may wants some styling added via CSS :)
I really love the feature your docs have though with config snippets that are interactable (clicking a setting name goes to that part of the docs, or hover reveals some extra information).
FYI https://github.com/caddyserver/website/pull/374, I'm working on a big docs update, this feedback is incorporated.
Feedback on the docs on Global Caddyfile
listener_wrappers
setting, hope it's somewhat helpful!Sorry about the verbosity, low on time π
Summary:
auto_https
implicit redirects seem broken with PROXY protocol support (see Traefik logs shared below)http_redirect
may have a bug or would benefit from clearer communication of caveat.http_redirect
should document placement order afterproxy_protocol
, similar to need for beforetls
.proxy_protocol
could better clarifyallow
expectations (suggestion provided below), possibly improve implementation.proxy_protocol
, could be better clarified in JSON docs.http_redirect
http_redirect
describes itself as important for redirecting HTTP to HTTPS when the request is arriving on an HTTPS port to avoid responding with "Client sent an HTTP request to an HTTPS server.".proxy_protocol
to work correctly (at least for those connections matchingallow
).http://
site addresses: Following the docs example (instead of configuring separate servers per port) will make these routes inaccessible as the redirection is forced (like implicit redirects fromautohttps
).http://
scheme and HTTP port. Should be no-op on the server using HTTP port?proxy_protocol
https://caddyserver.com/docs/json/apps/http/servers/listener_wrappers/proxy_protocol/#allow
/32
CIDR notation) or IP ranges are configured, anything else is not trusted for PROXY protocol connections, while the allowed IPs are required to provide the PROXY protocol header?This is fine, just comparing to other software it might be helpful to clarify expectations?:
"Allow is an optional list of trusted CIDR ranges expected to provide PROXY headers. Untrusted IPs using PROXY protocol will be rejected, but may otherwise connect normally without PROXY protocol."
Reference - Comparison to other implementations
Here's what I've noticed from least flexible to most flexible:
I think Traefik has it right there, by enforcing communicating trust by default (a list of trusted IPs or toggle insecure) while allowing regular connections through that aren't using PROXY protocol? (other software is a bit inconvenient by requiring separate ports for internal clients)
Caddy can manage to handle this distinction well enough when the specific trusted IPs are known, but
allow
couldn't use a wider private range subnet liketrusted_proxies
due to trusted IPs enforcing the requirement for PROXY header (I'm having trouble understanding why that needs to be enforced, other than preventing misconfiguration from hosts that are expected to always send the PROXY header?).Observation - Bugs?
When connecting to an HTTPS site address via curl and the following config:
From the client IP
172.16.42.42
and Traefik (172.16.42.10
):tls
.The Caddy docs are rather clear about
proxy_protocol
needing to come beforetls
, so I assume the error is from the PROXY header being present via Traefik and thetls
being implicitly before it πThat all makes sense, but if
tls
is uncommented, while HTTPS works correctly, HTTP fails with400 Bad Request
, Traefik wasn't able to connect to Caddy on port 80:http://
site address block. TCP router with PROXY protocol can be used then.I know that by default the
auto_https
feature would have enabled the implicit redirects, and thathttp://
site block explicitly opts-out of that feature. I guess something there is not compatible the PROXY protocol support? π€·ββοΈI can also add
http_redirect
afterproxy_protocol
to restore that redirect behaviour for PROXY protocol connections to Caddy, it must be afterproxy_protocol
though to work. Alternatively in this scenario, Traefik could also handle HTTP => HTTPS, but Traefik isn't relevant here, only used to test support introduced in Caddy 2.7.I don't have any need for PROXY protocol with HTTP/HTTPS myself, I have used it for TCP traffic for mail servers but was curious about the Caddy 2.7 support and how it compared to the equivalent support in Traefik. Not sure how it compares to the Caddy L4 app, I haven't tried that yet due to current JSON only support.
Misc
Not sure why, but
proxy_protocol
has two entries listed (_JSON docs forlistener_wrappers
_) with one marked asnon-standard
:Seems to be better communicated here:
The PROXY protocol links point to docs location from HAProxy
1.8
release (that seems to have been updated since) but should probably reference a more direct source?: https://github.com/haproxy/haproxy/blob/master/doc/proxy-protocol.txt