What is difference between httpS and http/2?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm trying to understand what is difference between https and http/2?



If i'm going to build node.js/express app, what should i use?



Can i use https with http/2?



Maybe if i use https, i don't need http/2 because it's the same or https use http/2 under the hood?



I'm confused.



Someone is linked to me "difference between HTTP 1.1 and HTTP 2.0 [closed]", but i understand differense between HTTP and HTTP2. I'm asking about HTTPS and HTTP/2










share|improve this question

























  • Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

    – Patrick Hund
    Nov 26 '18 at 20:34











  • @PatrickHund i dont see any mention about https in your link.

    – RTW
    Nov 26 '18 at 20:38











  • Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

    – Kevin B
    Nov 26 '18 at 20:40













  • Maybe... a more usefull will be to answer a question?

    – RTW
    Nov 26 '18 at 20:41


















0















I'm trying to understand what is difference between https and http/2?



If i'm going to build node.js/express app, what should i use?



Can i use https with http/2?



Maybe if i use https, i don't need http/2 because it's the same or https use http/2 under the hood?



I'm confused.



Someone is linked to me "difference between HTTP 1.1 and HTTP 2.0 [closed]", but i understand differense between HTTP and HTTP2. I'm asking about HTTPS and HTTP/2










share|improve this question

























  • Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

    – Patrick Hund
    Nov 26 '18 at 20:34











  • @PatrickHund i dont see any mention about https in your link.

    – RTW
    Nov 26 '18 at 20:38











  • Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

    – Kevin B
    Nov 26 '18 at 20:40













  • Maybe... a more usefull will be to answer a question?

    – RTW
    Nov 26 '18 at 20:41














0












0








0








I'm trying to understand what is difference between https and http/2?



If i'm going to build node.js/express app, what should i use?



Can i use https with http/2?



Maybe if i use https, i don't need http/2 because it's the same or https use http/2 under the hood?



I'm confused.



Someone is linked to me "difference between HTTP 1.1 and HTTP 2.0 [closed]", but i understand differense between HTTP and HTTP2. I'm asking about HTTPS and HTTP/2










share|improve this question
















I'm trying to understand what is difference between https and http/2?



If i'm going to build node.js/express app, what should i use?



Can i use https with http/2?



Maybe if i use https, i don't need http/2 because it's the same or https use http/2 under the hood?



I'm confused.



Someone is linked to me "difference between HTTP 1.1 and HTTP 2.0 [closed]", but i understand differense between HTTP and HTTP2. I'm asking about HTTPS and HTTP/2







node.js express https http2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 20:40







RTW

















asked Nov 26 '18 at 20:31









RTWRTW

909321




909321













  • Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

    – Patrick Hund
    Nov 26 '18 at 20:34











  • @PatrickHund i dont see any mention about https in your link.

    – RTW
    Nov 26 '18 at 20:38











  • Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

    – Kevin B
    Nov 26 '18 at 20:40













  • Maybe... a more usefull will be to answer a question?

    – RTW
    Nov 26 '18 at 20:41



















  • Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

    – Patrick Hund
    Nov 26 '18 at 20:34











  • @PatrickHund i dont see any mention about https in your link.

    – RTW
    Nov 26 '18 at 20:38











  • Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

    – Kevin B
    Nov 26 '18 at 20:40













  • Maybe... a more usefull will be to answer a question?

    – RTW
    Nov 26 '18 at 20:41

















Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

– Patrick Hund
Nov 26 '18 at 20:34





Possible duplicate of difference between HTTP 1.1 and HTTP 2.0

– Patrick Hund
Nov 26 '18 at 20:34













@PatrickHund i dont see any mention about https in your link.

– RTW
Nov 26 '18 at 20:38





@PatrickHund i dont see any mention about https in your link.

– RTW
Nov 26 '18 at 20:38













Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

– Kevin B
Nov 26 '18 at 20:40







Maybe... a more useful thing for you to investigate would be http vs https. Otherwise, you're comparing apples and refrigerators.

– Kevin B
Nov 26 '18 at 20:40















Maybe... a more usefull will be to answer a question?

– RTW
Nov 26 '18 at 20:41





Maybe... a more usefull will be to answer a question?

– RTW
Nov 26 '18 at 20:41












2 Answers
2






active

oldest

votes


















1














HTTP - A protocol used by clients (e.g. web browsers) to request resources from servers (e.g. web servers).



HTTPS - A way of encrypting HTTP. It basically wraps HTTP messages up in an encrypted format using SSL/TLS. The web is moving towards HTTPS more and more and web browsers are starting to put more and more warnings when a website is served over unencrypted HTTP. Unless you have a very good reason use HTTPS and any websites you create now.



Digging into HTTP more we have:



HTTP/1.1 - the prevalent format of HTTP at present. It is a text based protocol and has some inefficiencies in it - especially when requesting lots of resources like a typical web page. HTTP/1.1 messages can be unencrypted (where web site address typically starts http://) or encrypted with HTTPS (where web site address typically starts https://). The client used the start of the URL to decide which to use.



HTTP/2 - a new version of HTTP released in 2015 which addresses some of the performance issues by moving away from a text based protocol to a binary protocol where each byte is clearly defined. This is easier to parse for clients and servers, leaves less room for errors and also allows multiplexing. HTTP/2, like HTTP/1.1, is available over unencrypted (http://) and encrypted (https://) channels but web browsers only support it over HTTPS, where it is decided whether to use HTTP/1.1 or HTTP/2 as part of the HTTPS negotiation at the start of the connection.



HTTP/2 is used by about a third of all websites at the time of writing. However not all clients support HTTP/2 so you should support HTTP/1.1 over HTTPS and HTTP/2 over HTTPS where possible (I believe node automatically does this for you when using the http module). I do not believe HTTP/1.1 will be retired any time soon. You should also consider supporting HTTP/1.1 over unencrypted HTTP and then redirect to HTTPS version (which will then use HTTP/1.1 or HTTP/2 as appropriate). A web server like Apache or Nginx in front of Node makes this easy.



HTTP/3 - the next version of HTTP, currently under development. It is expected to be finalised in 2019 though it will likely be 2020 before you see this available in web servers and languages like node. It will be built on top of a UDP based transport called QUIC (rather than the TCP based protocol that HTTP/1.1 and HTTP/2 are based on top of). It will include part of HTTPS in the protocol so HTTP/3 will only be available over HTTPS.



In short you should use HTTP/1.1 over HTTPS, should consider HTTP/2 as well if easy to implement (not always possible as not quite ubiquitous yet - but getting there) and in future you might be using HTTP/3.



I suggest you get a firm understanding of all of these technologies (except maybe HTTP/3 just yet) if you want to do web development. It will stand you in good stead.






share|improve this answer































    0














    HTTP2 is supported in all modern browsers only over a secure connection.



    So if you want to use http/2, you will need to use https.



    I found a way to do it with fastify like this:



    'use strict'

    const fs = require('fs')
    const path = require('path')
    const fastify = require('fastify')({
    http2: true,
    https: {
    key: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.key')),
    cert: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.cert'))
    }
    })

    fastify.get('/', function (request, reply) {
    reply.code(200).send({ hello: 'world' })
    })

    fastify.listen(3000)





    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488601%2fwhat-is-difference-between-https-and-http-2%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      HTTP - A protocol used by clients (e.g. web browsers) to request resources from servers (e.g. web servers).



      HTTPS - A way of encrypting HTTP. It basically wraps HTTP messages up in an encrypted format using SSL/TLS. The web is moving towards HTTPS more and more and web browsers are starting to put more and more warnings when a website is served over unencrypted HTTP. Unless you have a very good reason use HTTPS and any websites you create now.



      Digging into HTTP more we have:



      HTTP/1.1 - the prevalent format of HTTP at present. It is a text based protocol and has some inefficiencies in it - especially when requesting lots of resources like a typical web page. HTTP/1.1 messages can be unencrypted (where web site address typically starts http://) or encrypted with HTTPS (where web site address typically starts https://). The client used the start of the URL to decide which to use.



      HTTP/2 - a new version of HTTP released in 2015 which addresses some of the performance issues by moving away from a text based protocol to a binary protocol where each byte is clearly defined. This is easier to parse for clients and servers, leaves less room for errors and also allows multiplexing. HTTP/2, like HTTP/1.1, is available over unencrypted (http://) and encrypted (https://) channels but web browsers only support it over HTTPS, where it is decided whether to use HTTP/1.1 or HTTP/2 as part of the HTTPS negotiation at the start of the connection.



      HTTP/2 is used by about a third of all websites at the time of writing. However not all clients support HTTP/2 so you should support HTTP/1.1 over HTTPS and HTTP/2 over HTTPS where possible (I believe node automatically does this for you when using the http module). I do not believe HTTP/1.1 will be retired any time soon. You should also consider supporting HTTP/1.1 over unencrypted HTTP and then redirect to HTTPS version (which will then use HTTP/1.1 or HTTP/2 as appropriate). A web server like Apache or Nginx in front of Node makes this easy.



      HTTP/3 - the next version of HTTP, currently under development. It is expected to be finalised in 2019 though it will likely be 2020 before you see this available in web servers and languages like node. It will be built on top of a UDP based transport called QUIC (rather than the TCP based protocol that HTTP/1.1 and HTTP/2 are based on top of). It will include part of HTTPS in the protocol so HTTP/3 will only be available over HTTPS.



      In short you should use HTTP/1.1 over HTTPS, should consider HTTP/2 as well if easy to implement (not always possible as not quite ubiquitous yet - but getting there) and in future you might be using HTTP/3.



      I suggest you get a firm understanding of all of these technologies (except maybe HTTP/3 just yet) if you want to do web development. It will stand you in good stead.






      share|improve this answer




























        1














        HTTP - A protocol used by clients (e.g. web browsers) to request resources from servers (e.g. web servers).



        HTTPS - A way of encrypting HTTP. It basically wraps HTTP messages up in an encrypted format using SSL/TLS. The web is moving towards HTTPS more and more and web browsers are starting to put more and more warnings when a website is served over unencrypted HTTP. Unless you have a very good reason use HTTPS and any websites you create now.



        Digging into HTTP more we have:



        HTTP/1.1 - the prevalent format of HTTP at present. It is a text based protocol and has some inefficiencies in it - especially when requesting lots of resources like a typical web page. HTTP/1.1 messages can be unencrypted (where web site address typically starts http://) or encrypted with HTTPS (where web site address typically starts https://). The client used the start of the URL to decide which to use.



        HTTP/2 - a new version of HTTP released in 2015 which addresses some of the performance issues by moving away from a text based protocol to a binary protocol where each byte is clearly defined. This is easier to parse for clients and servers, leaves less room for errors and also allows multiplexing. HTTP/2, like HTTP/1.1, is available over unencrypted (http://) and encrypted (https://) channels but web browsers only support it over HTTPS, where it is decided whether to use HTTP/1.1 or HTTP/2 as part of the HTTPS negotiation at the start of the connection.



        HTTP/2 is used by about a third of all websites at the time of writing. However not all clients support HTTP/2 so you should support HTTP/1.1 over HTTPS and HTTP/2 over HTTPS where possible (I believe node automatically does this for you when using the http module). I do not believe HTTP/1.1 will be retired any time soon. You should also consider supporting HTTP/1.1 over unencrypted HTTP and then redirect to HTTPS version (which will then use HTTP/1.1 or HTTP/2 as appropriate). A web server like Apache or Nginx in front of Node makes this easy.



        HTTP/3 - the next version of HTTP, currently under development. It is expected to be finalised in 2019 though it will likely be 2020 before you see this available in web servers and languages like node. It will be built on top of a UDP based transport called QUIC (rather than the TCP based protocol that HTTP/1.1 and HTTP/2 are based on top of). It will include part of HTTPS in the protocol so HTTP/3 will only be available over HTTPS.



        In short you should use HTTP/1.1 over HTTPS, should consider HTTP/2 as well if easy to implement (not always possible as not quite ubiquitous yet - but getting there) and in future you might be using HTTP/3.



        I suggest you get a firm understanding of all of these technologies (except maybe HTTP/3 just yet) if you want to do web development. It will stand you in good stead.






        share|improve this answer


























          1












          1








          1







          HTTP - A protocol used by clients (e.g. web browsers) to request resources from servers (e.g. web servers).



          HTTPS - A way of encrypting HTTP. It basically wraps HTTP messages up in an encrypted format using SSL/TLS. The web is moving towards HTTPS more and more and web browsers are starting to put more and more warnings when a website is served over unencrypted HTTP. Unless you have a very good reason use HTTPS and any websites you create now.



          Digging into HTTP more we have:



          HTTP/1.1 - the prevalent format of HTTP at present. It is a text based protocol and has some inefficiencies in it - especially when requesting lots of resources like a typical web page. HTTP/1.1 messages can be unencrypted (where web site address typically starts http://) or encrypted with HTTPS (where web site address typically starts https://). The client used the start of the URL to decide which to use.



          HTTP/2 - a new version of HTTP released in 2015 which addresses some of the performance issues by moving away from a text based protocol to a binary protocol where each byte is clearly defined. This is easier to parse for clients and servers, leaves less room for errors and also allows multiplexing. HTTP/2, like HTTP/1.1, is available over unencrypted (http://) and encrypted (https://) channels but web browsers only support it over HTTPS, where it is decided whether to use HTTP/1.1 or HTTP/2 as part of the HTTPS negotiation at the start of the connection.



          HTTP/2 is used by about a third of all websites at the time of writing. However not all clients support HTTP/2 so you should support HTTP/1.1 over HTTPS and HTTP/2 over HTTPS where possible (I believe node automatically does this for you when using the http module). I do not believe HTTP/1.1 will be retired any time soon. You should also consider supporting HTTP/1.1 over unencrypted HTTP and then redirect to HTTPS version (which will then use HTTP/1.1 or HTTP/2 as appropriate). A web server like Apache or Nginx in front of Node makes this easy.



          HTTP/3 - the next version of HTTP, currently under development. It is expected to be finalised in 2019 though it will likely be 2020 before you see this available in web servers and languages like node. It will be built on top of a UDP based transport called QUIC (rather than the TCP based protocol that HTTP/1.1 and HTTP/2 are based on top of). It will include part of HTTPS in the protocol so HTTP/3 will only be available over HTTPS.



          In short you should use HTTP/1.1 over HTTPS, should consider HTTP/2 as well if easy to implement (not always possible as not quite ubiquitous yet - but getting there) and in future you might be using HTTP/3.



          I suggest you get a firm understanding of all of these technologies (except maybe HTTP/3 just yet) if you want to do web development. It will stand you in good stead.






          share|improve this answer













          HTTP - A protocol used by clients (e.g. web browsers) to request resources from servers (e.g. web servers).



          HTTPS - A way of encrypting HTTP. It basically wraps HTTP messages up in an encrypted format using SSL/TLS. The web is moving towards HTTPS more and more and web browsers are starting to put more and more warnings when a website is served over unencrypted HTTP. Unless you have a very good reason use HTTPS and any websites you create now.



          Digging into HTTP more we have:



          HTTP/1.1 - the prevalent format of HTTP at present. It is a text based protocol and has some inefficiencies in it - especially when requesting lots of resources like a typical web page. HTTP/1.1 messages can be unencrypted (where web site address typically starts http://) or encrypted with HTTPS (where web site address typically starts https://). The client used the start of the URL to decide which to use.



          HTTP/2 - a new version of HTTP released in 2015 which addresses some of the performance issues by moving away from a text based protocol to a binary protocol where each byte is clearly defined. This is easier to parse for clients and servers, leaves less room for errors and also allows multiplexing. HTTP/2, like HTTP/1.1, is available over unencrypted (http://) and encrypted (https://) channels but web browsers only support it over HTTPS, where it is decided whether to use HTTP/1.1 or HTTP/2 as part of the HTTPS negotiation at the start of the connection.



          HTTP/2 is used by about a third of all websites at the time of writing. However not all clients support HTTP/2 so you should support HTTP/1.1 over HTTPS and HTTP/2 over HTTPS where possible (I believe node automatically does this for you when using the http module). I do not believe HTTP/1.1 will be retired any time soon. You should also consider supporting HTTP/1.1 over unencrypted HTTP and then redirect to HTTPS version (which will then use HTTP/1.1 or HTTP/2 as appropriate). A web server like Apache or Nginx in front of Node makes this easy.



          HTTP/3 - the next version of HTTP, currently under development. It is expected to be finalised in 2019 though it will likely be 2020 before you see this available in web servers and languages like node. It will be built on top of a UDP based transport called QUIC (rather than the TCP based protocol that HTTP/1.1 and HTTP/2 are based on top of). It will include part of HTTPS in the protocol so HTTP/3 will only be available over HTTPS.



          In short you should use HTTP/1.1 over HTTPS, should consider HTTP/2 as well if easy to implement (not always possible as not quite ubiquitous yet - but getting there) and in future you might be using HTTP/3.



          I suggest you get a firm understanding of all of these technologies (except maybe HTTP/3 just yet) if you want to do web development. It will stand you in good stead.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 22:13









          Barry PollardBarry Pollard

          17.8k32850




          17.8k32850

























              0














              HTTP2 is supported in all modern browsers only over a secure connection.



              So if you want to use http/2, you will need to use https.



              I found a way to do it with fastify like this:



              'use strict'

              const fs = require('fs')
              const path = require('path')
              const fastify = require('fastify')({
              http2: true,
              https: {
              key: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.key')),
              cert: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.cert'))
              }
              })

              fastify.get('/', function (request, reply) {
              reply.code(200).send({ hello: 'world' })
              })

              fastify.listen(3000)





              share|improve this answer




























                0














                HTTP2 is supported in all modern browsers only over a secure connection.



                So if you want to use http/2, you will need to use https.



                I found a way to do it with fastify like this:



                'use strict'

                const fs = require('fs')
                const path = require('path')
                const fastify = require('fastify')({
                http2: true,
                https: {
                key: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.key')),
                cert: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.cert'))
                }
                })

                fastify.get('/', function (request, reply) {
                reply.code(200).send({ hello: 'world' })
                })

                fastify.listen(3000)





                share|improve this answer


























                  0












                  0








                  0







                  HTTP2 is supported in all modern browsers only over a secure connection.



                  So if you want to use http/2, you will need to use https.



                  I found a way to do it with fastify like this:



                  'use strict'

                  const fs = require('fs')
                  const path = require('path')
                  const fastify = require('fastify')({
                  http2: true,
                  https: {
                  key: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.key')),
                  cert: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.cert'))
                  }
                  })

                  fastify.get('/', function (request, reply) {
                  reply.code(200).send({ hello: 'world' })
                  })

                  fastify.listen(3000)





                  share|improve this answer













                  HTTP2 is supported in all modern browsers only over a secure connection.



                  So if you want to use http/2, you will need to use https.



                  I found a way to do it with fastify like this:



                  'use strict'

                  const fs = require('fs')
                  const path = require('path')
                  const fastify = require('fastify')({
                  http2: true,
                  https: {
                  key: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.key')),
                  cert: fs.readFileSync(path.join(__dirname, '..', 'https', 'fastify.cert'))
                  }
                  })

                  fastify.get('/', function (request, reply) {
                  reply.code(200).send({ hello: 'world' })
                  })

                  fastify.listen(3000)






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 26 '18 at 21:13









                  RTWRTW

                  909321




                  909321






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488601%2fwhat-is-difference-between-https-and-http-2%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      To store a contact into the json file from server.js file using a class in NodeJS

                      Redirect URL with Chrome Remote Debugging Android Devices

                      Dieringhausen