Node.js on Elastic beanstalk requests are HTTPS but express is served as HTTP. Is this secure?





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







0















I have node express project that is hosted on AWS elastic beanstalk. My requests are HTTPS when i check the network tab in my dev tools. However my node express app's code is served in HTTP. Do I need to change the "http" module to "https"?
If I do then wont I have to provide some key somewhere from AWS?



const http = require('http');
const app = require('./app');

const normalizePort = val => {
var port = parseInt(val, 10);

if (isNaN(port)) {
// named pipe
return val;
}

if (port >= 0) {
// port number
return port;
}

return false;
};


const onListening = () => {
const addr = server.address();
const bind = typeof addr === "string" ? "pipe " + addr : "port " + port;
//debug("Listening on " + bind);
};

const port = normalizePort(process.env.PORT || "8081");
app.set("port", port);

const server = http.createServer(app);
server.on("error", onError);
server.on("listening", onListening);
server.listen(port);









share|improve this question





























    0















    I have node express project that is hosted on AWS elastic beanstalk. My requests are HTTPS when i check the network tab in my dev tools. However my node express app's code is served in HTTP. Do I need to change the "http" module to "https"?
    If I do then wont I have to provide some key somewhere from AWS?



    const http = require('http');
    const app = require('./app');

    const normalizePort = val => {
    var port = parseInt(val, 10);

    if (isNaN(port)) {
    // named pipe
    return val;
    }

    if (port >= 0) {
    // port number
    return port;
    }

    return false;
    };


    const onListening = () => {
    const addr = server.address();
    const bind = typeof addr === "string" ? "pipe " + addr : "port " + port;
    //debug("Listening on " + bind);
    };

    const port = normalizePort(process.env.PORT || "8081");
    app.set("port", port);

    const server = http.createServer(app);
    server.on("error", onError);
    server.on("listening", onListening);
    server.listen(port);









    share|improve this question

























      0












      0








      0








      I have node express project that is hosted on AWS elastic beanstalk. My requests are HTTPS when i check the network tab in my dev tools. However my node express app's code is served in HTTP. Do I need to change the "http" module to "https"?
      If I do then wont I have to provide some key somewhere from AWS?



      const http = require('http');
      const app = require('./app');

      const normalizePort = val => {
      var port = parseInt(val, 10);

      if (isNaN(port)) {
      // named pipe
      return val;
      }

      if (port >= 0) {
      // port number
      return port;
      }

      return false;
      };


      const onListening = () => {
      const addr = server.address();
      const bind = typeof addr === "string" ? "pipe " + addr : "port " + port;
      //debug("Listening on " + bind);
      };

      const port = normalizePort(process.env.PORT || "8081");
      app.set("port", port);

      const server = http.createServer(app);
      server.on("error", onError);
      server.on("listening", onListening);
      server.listen(port);









      share|improve this question














      I have node express project that is hosted on AWS elastic beanstalk. My requests are HTTPS when i check the network tab in my dev tools. However my node express app's code is served in HTTP. Do I need to change the "http" module to "https"?
      If I do then wont I have to provide some key somewhere from AWS?



      const http = require('http');
      const app = require('./app');

      const normalizePort = val => {
      var port = parseInt(val, 10);

      if (isNaN(port)) {
      // named pipe
      return val;
      }

      if (port >= 0) {
      // port number
      return port;
      }

      return false;
      };


      const onListening = () => {
      const addr = server.address();
      const bind = typeof addr === "string" ? "pipe " + addr : "port " + port;
      //debug("Listening on " + bind);
      };

      const port = normalizePort(process.env.PORT || "8081");
      app.set("port", port);

      const server = http.createServer(app);
      server.on("error", onError);
      server.on("listening", onListening);
      server.listen(port);






      node.js amazon-web-services express amazon-elastic-beanstalk






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 18:05









      TotenKopfTotenKopf

      378




      378
























          1 Answer
          1






          active

          oldest

          votes


















          2














          You don't have to change it to HTTPS .



          When you use AWS EB , you get the load balancer(ELB) with the certificate + nginx on each machine used to reverse proxy to your app .



          AWS help you secure the connection up to the load balancer for free .



          it's up to you if you want to add an extra layer of security.



          for most use cases , unless you really deal with very sensitive data (medical, industry) the first layer is good enough and will keep all connection to the ELB secured and untouched .



          If you do want to add the extra layer of security , you can create a certificate with "let's encrypt" , save the keys on your machine , and start the server with https and configure the keys .



          take a look at:
          https://www.sitepoint.com/how-to-use-ssltls-with-node-js/



          it's using certbot (Let's encrypt cli ...)






          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%2f53343189%2fnode-js-on-elastic-beanstalk-requests-are-https-but-express-is-served-as-http-i%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You don't have to change it to HTTPS .



            When you use AWS EB , you get the load balancer(ELB) with the certificate + nginx on each machine used to reverse proxy to your app .



            AWS help you secure the connection up to the load balancer for free .



            it's up to you if you want to add an extra layer of security.



            for most use cases , unless you really deal with very sensitive data (medical, industry) the first layer is good enough and will keep all connection to the ELB secured and untouched .



            If you do want to add the extra layer of security , you can create a certificate with "let's encrypt" , save the keys on your machine , and start the server with https and configure the keys .



            take a look at:
            https://www.sitepoint.com/how-to-use-ssltls-with-node-js/



            it's using certbot (Let's encrypt cli ...)






            share|improve this answer




























              2














              You don't have to change it to HTTPS .



              When you use AWS EB , you get the load balancer(ELB) with the certificate + nginx on each machine used to reverse proxy to your app .



              AWS help you secure the connection up to the load balancer for free .



              it's up to you if you want to add an extra layer of security.



              for most use cases , unless you really deal with very sensitive data (medical, industry) the first layer is good enough and will keep all connection to the ELB secured and untouched .



              If you do want to add the extra layer of security , you can create a certificate with "let's encrypt" , save the keys on your machine , and start the server with https and configure the keys .



              take a look at:
              https://www.sitepoint.com/how-to-use-ssltls-with-node-js/



              it's using certbot (Let's encrypt cli ...)






              share|improve this answer


























                2












                2








                2







                You don't have to change it to HTTPS .



                When you use AWS EB , you get the load balancer(ELB) with the certificate + nginx on each machine used to reverse proxy to your app .



                AWS help you secure the connection up to the load balancer for free .



                it's up to you if you want to add an extra layer of security.



                for most use cases , unless you really deal with very sensitive data (medical, industry) the first layer is good enough and will keep all connection to the ELB secured and untouched .



                If you do want to add the extra layer of security , you can create a certificate with "let's encrypt" , save the keys on your machine , and start the server with https and configure the keys .



                take a look at:
                https://www.sitepoint.com/how-to-use-ssltls-with-node-js/



                it's using certbot (Let's encrypt cli ...)






                share|improve this answer













                You don't have to change it to HTTPS .



                When you use AWS EB , you get the load balancer(ELB) with the certificate + nginx on each machine used to reverse proxy to your app .



                AWS help you secure the connection up to the load balancer for free .



                it's up to you if you want to add an extra layer of security.



                for most use cases , unless you really deal with very sensitive data (medical, industry) the first layer is good enough and will keep all connection to the ELB secured and untouched .



                If you do want to add the extra layer of security , you can create a certificate with "let's encrypt" , save the keys on your machine , and start the server with https and configure the keys .



                take a look at:
                https://www.sitepoint.com/how-to-use-ssltls-with-node-js/



                it's using certbot (Let's encrypt cli ...)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 19:10









                Mazki516Mazki516

                6431517




                6431517
































                    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%2f53343189%2fnode-js-on-elastic-beanstalk-requests-are-https-but-express-is-served-as-http-i%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

                    Florida Star v. B. J. F.

                    Danny Elfman

                    Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues