SSL requests failing

Posted on
  • In my test script I have these options

    var options = {
          host:   '', 
          port:   443,    
          path:   '/',   
          method: 'GET', 
          protocol: 'https:',

    and this code after the definition.

    var req = require("http").request(options, function(res) {
        res.on('data', function(data) {
          console.log("HTTP> "+data);
        res.on('close', function(data) {
          console.log("Connection closed");

    However, I keep getting a code 400 reply "The plain HTTP request was sent to HTTPS port". There are no redirects at the server end and I have tested the same functionality with my own server, address - with the same result.

    The script seems to be using http, despite all my attempts to switch to https. Do I have two blind eyes? I have one semi-blind already :)


  • Oh, I see, after finding the information accidentally: Hardly any boards can use HTTPS requests. I wish this fact had been written onto the http.request documentation. Now the information can only be found here: and nowhere else.

    Well, I experienced a moment of re-evaluation at this point. In private (unsecure) projects, I think http may work, though.

    Anyhow, after such a good start I had, this was somewhat disappointing.

  • The ESP8266 is so limited that it's definitly not possible. ESP32 can do after deactivate of BLE or if you use a board with PSRAM

  • Well, for this project, the lack of SSL is not the killer. I can definitely do a lot at the remote server end (like limiting the access to an IP range), or possibly add an Nginx/PHP server as a mediator :)

    Espruino is somewhat weird, but fun to work with, especially when writing the JS app in TypeScript. It is much move convenient than MicroPython, for instance. I like the event-driven approach.

  • Dear MaBe,

    I would like to know if the psram is "automatically" used by e.g. wrover or if something has to be set when uploading the firmware?

  • hi, on esp32 it is detected during boot.

  • Thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

SSL requests failing

Posted by Avatar for mkniskanen @mkniskanen