Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

HTTPS POST <body> is lost during redirect ESP2866/Arduino

Open GamerClassN7 opened this issue 6 years ago • 4 comments

Hi, i am working on custome SimpleHome (SmartHome Server) project i run in to the issue. If i want to use HTTPs, ESP lose request payload i realy try to do every possible alternative and nothing worked can someone sugest what i am dooing wrong ? i am running code on ESP2866 custome borad based on NodeMCU. Thanks for any answer.

Description:

ESP is not able to send POST body on redirect, but if i test API with Insomnia of Curl everithing works fine.

Server Response:

image

Sketch: https://raw.githubusercontent.com/Simple-Home/SmartHome-Firmwares/master/firmwares/PlatformIO/S20/src/main.cpp

GamerClassN7 avatar Jul 13 '20 11:07 GamerClassN7

Some "spec" context for discussion: https://softwareengineering.stackexchange.com/questions/99894/why-doesnt-http-have-post-redirect

liebman avatar Jul 13 '20 15:07 liebman

I see lots of 401 errors there. 401 = Unauthorized, likely a permissions problem. Your code should be checking http response codes and not trying to parse json objects when there's no object there to parse. This seems like user error and not a core issue.

MarkusAD avatar Jul 14 '20 03:07 MarkusAD

@MarkyAD That is the problem post body is lost during redirect from dodz contains token so it is not authorized on server.

GamerClassN7 avatar Jul 15 '20 12:07 GamerClassN7

You should've filled out the issue template you were presented with when you made this post, otherwise the devs probably wont even look at it. If you think this is a core problem then close this and make another post with all the needed info filled in, including the smallest possible complete sketch which demonstrates the problem.

MarkusAD avatar Jul 15 '20 15:07 MarkusAD