News for hackers. Stuff that matters.
Re:HTTP/2 Server Push on Netlify by jitl on Tuesday July 18, 2017 @01:35PM (#14798450)
> It’s important to understand that HTTP/2 requires secure connectivity. Only websites with HTTPS enabled can take advantage of HTTP/2 and its performance optimizations, like server push and header compression.

Pedantically, this is not correct. HTTP/2 does not mandate any encryption. But, all the browser vendors only support HTTP/2 with TLS. https://http2.github.io/faq/#does-http2-require-encryption

Re:HTTP/2 Server Push on Netlify by richardwhiuk on Tuesday July 18, 2017 @01:48PM (#14798586)
If you assume the second sentence explains the first, then this is correct - only websites (i.e something designed to be consumed by browsers) with HTTPS can take advantage of HTTP/2.
Re:HTTP/2 Server Push on Netlify by fredliu on Tuesday July 18, 2017 @02:07PM (#14798721)
This is true, but no mandate on encryption in the HTTP/2 standard was an deliberate decision, one of the very few differences between HTTP/2 and SPDY. But yes, practically, you can't use HTTP/2 without encryption nowadays.
Re:HTTP/2 Server Push on Netlify by thearrow on Tuesday July 18, 2017 @01:51PM (#14798606)
How do people go about sending Link headers / configuring server push for resources with a changing hash in their filenames?

For example if you have your app.ab9a9a09fe9.js file, but then the next deploy you have your app.ba293dcde.js file... can you just set the resource to app.*.js somehow?

Re:HTTP/2 Server Push on Netlify by Svenskunganka on Tuesday July 18, 2017 @02:15PM (#14798787)
You can make it part of your build process to generate a file with the headers needed, and during deploy it gets copied and/or configures the web server/platform you're running on.
Re:HTTP/2 Server Push on Netlify by treve on Tuesday July 18, 2017 @02:00PM (#14798665)
If you can write a <script> tag that references app.ab9a9a09fe9.js, presumably you can write a HTTP header that references that same file, no?
Re:HTTP/2 Server Push on Netlify by thearrow on Tuesday July 18, 2017 @04:18PM (#14799716)
For example: a SPA webpack setup using html-webpack-plugin which generates the <script> tags in index.html for the different assets, later served by nginx or similar.

How does one tell nginx the names of the files to push if they are generated dynamically? You have to put the names in a separate file and then somehow configure the server using that file?

Re:HTTP/2 Server Push on Netlify by calavera on Tuesday July 18, 2017 @07:40PM (#14800971)
this webpack plugin might help you: https://gist.github.com/Kamshak/35630ec21df8dca27de3bb915f2d...

I have no idea why the original comment by the author is shadow banned.

Re:HTTP/2 Server Push on Netlify by waxjar on Tuesday July 18, 2017 @02:20PM (#14798840)
What about a static website served through nginx, for example?
Re:HTTP/2 Server Push on Netlify by StavrosK on Tuesday July 18, 2017 @03:16PM (#14799250)
I'm actually just doing that right now (changing my static website to work with Netlify's Push). Presumably, your base HTML looks something like this:

  <link href="{{ "main.css"|asseturl }}" rel="stylesheet" type="text/css" />
Then, your _headers.j2 file should look like this:

  /*
    Link: <{{ "main.css"|asseturl }}>; rel=preload; as=stylesheet
Which will just be replaced with the correct value, same as in your HTML template.
Re:HTTP/2 Server Push on Netlify by Kamshak on Tuesday July 18, 2017 @07:35PM (#14800940)
I suppose you are using webpack, i have just written a small plugin for this (assumes an SPA, writes the same js/css to /*): https://gist.github.com/Kamshak/35630ec21df8dca27de3bb915f2d...
Re:HTTP/2 Server Push on Netlify by OJFord on Tuesday July 18, 2017 @06:59PM (#14800715)
> Developers love using the CLI because everything can be done from the command line.

What? Do users also love the UI because everything can be done by the user?

Re:HTTP/2 Server Push on Netlify by StavrosK on Tuesday July 18, 2017 @04:09PM (#14799646)
This is welcome, but doesn't seem to be ready. My site broke with SPDY errors (wth?) when I enabled this.
Re:HTTP/2 Server Push on Netlify by calavera on Tuesday July 18, 2017 @04:26PM (#14799790)
Hey StavrosK, don't hesitate to reach out to Netlify support. I'd love to take a look at your site to figure out what's going on there.
Re:HTTP/2 Server Push on Netlify by StavrosK on Tuesday July 18, 2017 @04:46PM (#14799934)
Yep, I already talked to Chris about it, thanks! I talked to you guys a week ago about HTTP/2 Push, I didn't know you'd have it ready so soon. I'm eager to get this working on stavros.io, so please feel free to email me so we can debug this!
Re:HTTP/2 Server Push on Netlify by calavera on Tuesday July 18, 2017 @07:34PM (#14800932)
I just deployed a change that we think it should fix the problem in your site, we're going to keep an eye on it \o/
Re:HTTP/2 Server Push on Netlify by judahtanthony on Friday July 21, 2017 @04:36PM (#14823598)
How does Netlify handle caching of push file? I would love to push my global.css and global.js; however, I don't want those files to be pushed on every subsequent request.
Re:HTTP/2 Server Push on Netlify by ezequiel-garzon on Tuesday July 18, 2017 @01:57PM (#14798646)
Do any browsers already provide a way to refuse pushed resources?
Re:HTTP/2 Server Push on Netlify by jbergstroem on Tuesday July 18, 2017 @02:18PM (#14798820)
You'd have to handle this in service workers. You want this: https://datatracker.ietf.org/doc/draft-ietf-httpbis-cache-di...
Re:HTTP/2 Server Push on Netlify by bfred_it on Wednesday July 19, 2017 @08:27AM (#14803781)
Why would you need this? The use case of Server Push is to download resources earlier than a browser can request them, but will eventually require anyway.

What are you hoping to refuse?

Re:HTTP/2 Server Push on Netlify by ezequiel-garzon on Wednesday July 19, 2017 @05:39PM (#14808210)
Thanks for the reply, and good point. I guess I feel uneasy about letting the server "push" at will, for instance when dealing with mobile data plans. But come to think about it, I don't have much control on what I'll get once I visit a website.
Re:HTTP/2 Server Push on Netlify by thinkMOAR on Wednesday July 19, 2017 @05:27AM (#14802986)
"You can read this article in the next version of Smashing Magazine, completely hosted on Netlify."

No actually quite a few resources are served by third parties.

Re:HTTP/2 Server Push on Netlify by Zpalmtree on Tuesday July 18, 2017 @03:39PM (#14799421)
I read this as Netflix and was very confused for a while.