vendredi 23 octobre 2020

Got a non 200 status code from server when try to GET method with ESP32

I try to use forceUpdate.ino example from esp32FOTA library.

Here is my Json file content hosted at: mhpro.net/fw

{ "type": "esp32-fota-http", "version": 2, "host": "mhpro.net", "port": 80, "bin": "/fw/forceUpdateBlink.ino.esp32.v2.bin" }

When the .bin file is on my PC's IIS webserver and I set 192.168.1.xxx as host, everything works well.

But when I try with the .bin file on the subfolder of my existing website, I get a "Non 200 status code from server" message.

If I try "mhpro.net/fw/forceUpdateBlink.ino.esp32.v2.bin" in Chrome, the file downloads.

Here is the library code that request the GET method:

// Get the contents of the bin file
client.print(String("GET ") + _bin + " HTTP/1.1\r\n" +
             "Host: " + _host + "\r\n" +
             "Cache-Control: no-cache\r\n" +
             "Connection: close\r\n\r\n");

On my website, http requests are redirected to https. Is it the cause? My website is on shared IP address (so I can't try with IP)

I am pretty sure that I can solve this issue with the .htacces file but I don't know how.

Actually , the folder's .htacces file contain only this line: "Options +Indexes"

Thank for your help

Martin




Aucun commentaire:

Enregistrer un commentaire