-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP 103 Early Hints support #4860
Comments
The very first step would be to make sure that caddy processes HTTP 103 properly while acting as a reverse proxy. That may already be the case. |
@dunglas has been working on adding support for early hints to the Go stdlib, I'm sure he'll follow up soon to make sure Caddy supports it sufficiently. |
Indeed it's on my todo list. We'll have to wait for Go 1.19 first. |
@dunglas does this also add support for HTTP3 based connections? |
@bt90 yes! I also patched the HTTP/3 library: quic-go/quic-go#3047 |
Is there any documentation on how use this feature now that it's implemented? If we do |
@pc-erin HTTP 103 is for applications to emit. The only "application" Caddy really offers (at least, built-in) is the static file server; I have been considering building a feature that will parse HTML and send 103 responses accordingly (like for CSS, JS, and image resources), but maybe at a future date. For now, this relays 103s from proxy backends down to the client. What's your use case? |
Using it in a reverse proxy scenario might also be neat. Add a matcher for the main page and tell the clients to also load files X, Y and Z. |
I was working on a PHP application (which apparently doesn't support 103) and also buffers the full output, so no streaming the html head down first. To mitigate this I thought it would be convenient to manually put some 103 hints in path handlers so that browsers could start downloading resources while PHP is building the response. Something like:
|
Proposal opened at #5005 |
Hey @mholt, When using 103 hints in a more conventional way, with caddy being a reverse proxy to an application that sends those responses, one useful feature is caching the 103 responses from previous requests and replying with those learned cached behaviors in newer requests. At the moment, AFAIK only Cloudflare implements this, but it can be very useful for Caddy to have something like this. Example:
If Caddy "learns" that requests to Cloudflare goes one step further, and even "learns" to 103 subsequent requests from
Curious about your opinions on this @mholt. |
@xfalcox We could do that... would require a new directive to enable it, I think. Probably best for someone to implement it as a separate plugin for now and see how popular and useful it is! |
RFC 8297 is only a draft, but is now supported by Chrome 103:
https://caniuse.com/mdn-http_status_103
and Mozilla also intends to support it:
https://bugzilla.mozilla.org/show_bug.cgi?id=1407355
Apache already implements it: https://httpd.apache.org/docs/2.4/howto/http2.html#earlyhints
It would be nice if caddy would add (experimental) support for it. Following the RFC recommendations, this should only be added for HTTP/2 and HTTP/3:
The text was updated successfully, but these errors were encountered: