maakbaas/esp8266-iot-framework

403 Forbidden response to GET request

Patxe opened this issue · 1 comments

Patxe commented

Hi,
first, thanks for your amazing work,
second, sorry if this is not the place to ask this question.
When I try to do a get request to any site, everything works, but when I try the one I need, "https://fop.saj-electric.com/saj/login" it doesn't work.

Sin título

another thing, how can I read the response headers, to then make the request with the received cookie?

Edit:
Testing, I discovered that the server needs the following headers to give a valid response

// fetch.addHeader("Host" , "47.89.245.226");
// fetch.addHeader("User-Agent" , "PostmanRuntime/7.29.2");
// fetch.addHeader("Accept" , "*/*");
// fetch.addHeader("Accept-Encoding" , "gzip, deflate, br");
// fetch.addHeader("Connection" , "keep-alive");

but when i add the headers it throws an exception

If you follow the documentation you should use the begin function in case you want to customize headers.

Like this:

fetch.begin("https://fop.saj-electric.com/saj/login");
fetch.addHeader("Host" , "47.89.245.226");
fetch.addHeader("User-Agent" , "PostmanRuntime/7.29.2");
fetch.addHeader("Accept" , "*/*");
fetch.addHeader("Accept-Encoding" , "gzip, deflate, br");
fetch.addHeader("Connection" , "keep-alive");
fetch.GET();