Search code examples
luaiotesp8266nodemcuifttt

How to use HTTPS post request in NodeMCU HTTP module


I am using following code with HTTP module of the NodeMCU firmware. As per the documentation both HTTP and HTTPS URLs should work.

https://nodemcu.readthedocs.io/en/master/en/modules/http/#httppost

Though I am getting error when I use 'https'. 'http' is working fine for me. For URL in code, I am facing following error.

"The plain http request was sent for HTTPS port".

Please help.

http.post('https://maker.ifttt.com/trigger/......',
        'Content-Type: application/json\r\n',
        '{"value1":"mainlobby"}', function(code, data)
        if (code < 0) then
            print("HTTP request failed")
        else
        print(code, data)
        end        
  end

Solution

  • I suspect that your firmware does not have SSL/TLS enabled. So, it would internally use http instead of https but still send it to port 443.