Modern web apps without JavaScript bundling or transpiling
We're way overdue a correction back to simplicity for the frontend. ES6/HTTP2/Import maps looks like they'll deliver just that.
Read more [world.hey.com]
Posts tagged with http2
We're way overdue a correction back to simplicity for the frontend. ES6/HTTP2/Import maps looks like they'll deliver just that.
Read more [world.hey.com]
Cloudflare pushes forward! Read the entire article for a good explanation on http2 and server push.
Today, we’re happy to announce HTTP/2 Server Push support for all of our customers. Server Push enables websites and APIs to speculatively deliver content to the web browser before the browser sends a request for it. This behavior is opportunistic, since in some cases, the content might already be in the client’s cache or not required at all.https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/
In semi-related news: Laravel Forge recently made a nice change as well. If you install an ssl certificate on a Froge provisioned server, http2 will be enabled by default.
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
"Freek publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
No spam. Unsubscribe anytime. You can also follow me on X.
Added on 2016-04-28: newly provisioned Forge servers will now use http2 by default whenever you install an ssl certifcate.
Like mentioned in the post on how to upgrade PHP, I'm a big fan of Forge. By default sites provisioned by Forge use regular http. Let's learn how to enable http2.
The http2 protocol provides a lot of benefits over http. In short it'll make your website load much faster. If want to know how this protocol works under the hood watch this excellent video by Mattias Geniar or read this blogpost at Cloudflare. Here an interesting test by (again) Mattias that shows the potential speed improvements.
A prerequisite for using http2 is that you serve your website via an encrypted connection (note: this is not 100% true but virtually all major browsers won't support http2 via unencrypted connections). Thanks to LetsEncrypt you can get free ssl certificates. Watch this free video on Laracasts to learn how to install a LetsEncrypt certificate.
Support for http2 was introduced in Nginx 1.9.5. You can check the version number of your Nginx installation by running nginx -v. If you're on 1.9.5 or higher you're good. You just have to add http2 to a server block in the Nginx configuration:
server {
listen 443 ssl http2;
...
}
The Chrome developer tools can be used to check if you're site is indeed using http2. The column "protocol" should display "h2".
Don't be overwhelmed with sadness if you're running something below Nginx 1.9.5. Upgrading is easy! Only three instructions are needed to upgrade to, at the time of this writing, Nginx 1.9.14:
sudo add-apt-repository ppa:nginx/development
sudo apt-get update
sudo apt-get install nginx
At this year's FOSDEM Mattias Geniar explained what HTTP/2 has in store for developers:
https://www.youtube.com/watch?v=QMm_qvCYwDk
Here are the slides used in his excellent talk:
https://speakerdeck.com/mattiasgeniar/2-for-php-developers
HTTP/2 has a great feature called server push. It enables the server to send multiple responses in parallel for one request. In a blogpost on the Symfony Finland blog Jani Tarvainen demonstrates how to make use of server push with the Symfony Kernel.
$app->get('/images'), function () use ($app) {
$images = array('/images/1.jpg','/images/2.jpg','/images/3.jpg');
$response = new JsonResponse($images);
foreach($images as $image){
$response->headers->set('link','<' . $image . '>; rel=preload; as=image',false);
}
return $response;
Read the entire article for some more background info.
HTTP2 will mean a change in how we should build websites. The best practices of HTTP1 are harmful in a HTTP2 world.https://mattwilcox.net/web-development/http2-for-front-end-web-developers
This is a "living document" in the sense that I keep posting updates, and I care about and value feedback, questions and comments I get about it. This document improves over time thanks to a joint effort.http://daniel.haxx.se/http2/
The arrival of HTTP/2 will require a bit of re-thinking how we handle websites (and webservers), so perhaps it's time to reflect on what those changes can bring. This post is based entirely on theory (the HTTP2 spec), as HTTP/2 is hard to test today (with a lack of servers and browser support).https://ma.ttias.be/architecting-websites-http2-era/
Compare load times of the unsecure HTTP and encrypted HTTPS versions of this page.https://www.httpvshttps.com/