Skip to content
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

HTTP 103 Early Hints #52

Closed
evanleck opened this issue Feb 21, 2019 · 11 comments
Closed

HTTP 103 Early Hints #52

evanleck opened this issue Feb 21, 2019 · 11 comments

Comments

@evanleck
Copy link

Just curious if support for early hints is planned?

@ohler55
Copy link
Owner

ohler55 commented Feb 21, 2019

Not planned yet. There is nothing stopping an application from returning a 103 though. How would you envision the use case?

@evanleck
Copy link
Author

The use-case I envision is a Rack application that plans to include some CSS and JS via <style> and <script> (normal stuff) using early hints to tell the browser to start downloading those files before the full response has been rendered. As I understand it, that's the primary use-case for early hints.

I can't find anything official in the Rack repository, but there's some support across Ruby projects that I've linked to below, as well as the RFC. The Puma PR may be the most interesting.

I think the biggest difference between real early hints and just returning a 103 is that a single request would produce 2 responses: one 103 with early hints Link headers and the other with the full response (e.g. from a Rack application).

@ohler55
Copy link
Owner

ohler55 commented Feb 21, 2019

Okay, its a feature that might go into the rack spec in the future. Lets leave this issue open for now and time permitting and a bit more research into rack plans and then it will get done.

@evanleck
Copy link
Author

Sounds good, thank you!

@ianks
Copy link

ianks commented Mar 14, 2019

We are currently using nginx with the http2_push_preload directive. This will turn Link headers into push promises. This is a much simpler and more compatible mechanism than sending a 103 IMO

http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_push_preload

@evanleck
Copy link
Author

@ianks that's really cool, thanks for the info! I didn't even know Nginx could do that to be honest. I don't have direct access to the reverse proxy's configuration file so I can't do that myself, but it's definitely good to know.

@ianks
Copy link

ianks commented Mar 16, 2019

Highly suggest it. Much easier to setup than h2o

@ohler55
Copy link
Owner

ohler55 commented Jul 17, 2019

Please try the early_hints branch. There is a unit test for the new feature.

@ohler55
Copy link
Owner

ohler55 commented Jul 19, 2019

Merged into develop branch.

@ohler55 ohler55 closed this as completed Aug 21, 2019
@ksr-13
Copy link

ksr-13 commented Oct 9, 2023

How do I enable early hints for agoo? I am trying to use agoo with Hanami 2.0. Hanami has instructions for this at https://guides.hanamirb.org/v1.3/projects/http2-early-hints/
Looking for the equivalent ""config/agoo"" changes.

@ohler55
Copy link
Owner

ohler55 commented Oct 9, 2023

Agoo::Server::rack_early_hints(true)

Take a look at the test/early_hints_test.rb file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants