12

As some of you may know, HTTP/2 was recently born.

From what I understood, it has been developed to just work with existing websites, which suggests that there is nothing to do to make Magento compatible with it.

However all the browsers have decided to only implement HTTP/2 for TLS (https) connections.

That said here are my questions:

  • what should I consider if I want to serve Magento over HTTP/2 ?
  • would enabling https for all pages (using secure URLs) be enough ?
  • if not, is there any core changes to be made to do so?

I'm looking for an answer for both Magento 1 and 2.

6

There is no problem with HTTP/2 "just working". But there is opportunity for further optimization.

My understanding is it is worth looking into capabilities of your CDN provider if you want to take full advantage of the push support. E.g. when request for first CSS etc file comes in, server can start pushing other files it knows you are almost certainly going to need. At least one CDN you could tell it the extra files to push. This is a part of what means you don't need to merge CSS and JS files - using pushes can be more efficient than sending a big merged file. But to get maximal performance, the CDN needs to know "when you fetch X, then push Y and Z as well". I don't know if they magically work this out for you or not (based on past traffic patterns).

  • from an article, I got know that these CDN ( cloudflare, maxcdn, keycdn ) support HTTP/2. – Kalyan Chakravarthi V Feb 10 '18 at 12:37
4

You definitely can use Http/2 with any version of Magento. And yes, you need to enable https for all pages (it's recommended setup for M2, why do you not did it before). Also, bundling of js files don't make sense with http2, so better to disable it

3

If you want to set all pages to HTTPS, you might also want to enable HSTS (More info: https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security).

For the rest of it, I never had any trouble using a webshop on HTTPS/2, so like Alan and KAndy say, it should just work.

0
  1. Your users should have latest browsers which support HTTP/2 protocol. If not request will be handled as normal HTTP request.

  2. Check if your server can handle HTTP/2 requests. If not ask your host provider to upgrade it to support HTTP/2.

  3. As far as I know, your requests should go through secure protocol https.

  4. In order to make use of server push feature use "Link" HTTP header as here

Link: </css/styles.css>; rel=preload; as=style

taken from the source https://www.smashingmagazine.com/2017/04/guide-http2-server-push/

  1. Here is one more article I followed ( https://www.upwork.com/hiring/development/the-http2-protocol-its-pros-cons-and-how-to-start-using-it/ ) that helped to completely understand about HTTP/2 protocol Pros and Cons. But for sure it is an emerging technology that is going to speed up the web.
-1

Magento works on http/2 and you can take advantage of all http/2 features on Magento. But as suggested in all the moves to http/2 you have to do things slightly differently.

  • do not splice your domain for skin / js / media.
  • do not merge css or js
  • figure out a way to minify the js and css

HTTP/2 falls back to HTTP/1 for older browsers. Given the different optimization needs I think the decision would be based on

  • Are a lot of your visitors on older browsers? A quick way to find out is to move to http/2 and review the web server log files to see how many web browsers switched down to http/1

You need to move your entire site to secure (https) to ensure the benefits are maximized.

  • Please do not promote your blog here... – 7ochem Feb 22 '17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.