-1

Good evening, I have a problem with NodeMCU programmed in Lua. I should get a https get request but I can't. I tried with the net module but it gives me the error of redirection 301. Using http.get instead it gives me an error - 114. How can I solve my problem? Is there a way to make https requests in Lua? My firmware is 2.2.1 custom with SSL true

Gio
  • 1
  • 1

1 Answers1

1

301 is not an error; It's a normal HTTP Status code that signals to a HTTP Client that the resource that it expected is no longer available at the given URL.

If I remember correctly, the new URI of the resource should be available in the HTTP Header Location. Most HTTP Libraries take care of these redirections for you, but it's possible that NodeMCU, aiming to be as small and simple as possible, doesn't do this.

Just look for that header when you get a 301 response and start a new request to that URI with the same callback.

DarkWiiPlayer
  • 6,871
  • 3
  • 23
  • 38