1. Caddy version (caddy version
):
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
macOS launchctl:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key>
<string>com.caddyserver.caddy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/env</string>
<string>XDG_CONFIG_HOME=/opt/local/etc/caddy</string>
<string>XDG_DATA_HOME=/opt/local/etc/caddy</string>
<string>/opt/local/sbin/caddy</string>
<string>run</string>
<string>-config</string>
<string>/opt/local/etc/caddy/caddy.conf</string>
<string>-adapter</string>
<string>caddyfile</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
a. System environment:
macOS 10.14.6 (18G7016)
b. Command:
N/A
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
{
servers {
protocol {
experimental_http3
}
}
}
www.timeheart.net, timeheart.net, ipv6.timeheart.net {
root * /Library/WebServer/Documents
file_server browse
reverse_proxy {
to grpc://localhost:50051
transport http {
versions h2c
}
}
header / Strict-Transport-Security "max-age=31536000;"
log {
output file /opt/local/var/log/caddy/main.log
}
}
3. The problem I’m having:
I’m experimenting with using Caddy as a reverse proxy to accept secure GRPC requests and forward them in the clear to a GRPC server on a different port on localhost. I have this working just fine for simple GRPC requests. However, I noticed something that I wanted to report.
It appears that Caddy can’t properly handle streaming requests when the client tries to read any of the response before finishing sending the request (which is common when using streaming RPC). Related to this, it appears it doesn’t handle a client trying to read the server metadata (which is communicated in h2 response headers) before sending its request. I believe this latter issue could apply to both streaming and unary requests.
This is not unexpected, as web servers typically forward the entirety of the client request to the server before beginning to forward any of the server’s response back to the client. However, for GRPC specifically, that’s not good enough to handle all cases.
Since Caddy seems to be explicitly supporting the “grpc://” scheme in its reverse_proxy, are there any plans to support this kind of interleaved streaming request/response or early request for metadata?
4. Error messages and/or full log output:
When trying to read response data before sending the complete request, the grpc client simply hangs waiting for response data from CaddyServer which never arrives.
5. What I already tried:
I confirmed that it works perfectly when I send the entire request before reading any response data. However, if I try to read either the server metadata or server response data prior to marking my request complete, it hangs.