1
0
mirror of https://github.com/daniviga/bite.git synced 2025-04-20 22:41:18 +02:00

Fix 400 error with Arduino telemetry and Nginx

This was caused by the client not waiting for a response.
Also Content-Length header was bogus.
This commit is contained in:
Daniele Viganò 2020-06-21 22:49:35 +02:00
parent b0b0f866df
commit 45d12b11a8
Signed by: dani
GPG Key ID: DB49AFC03C40EE02
2 changed files with 5 additions and 1 deletions

View File

@ -162,7 +162,7 @@ void postData(const netConfig &postAPI, const String &URL, const DynamicJsonDocu
ethClient.println(postAPI.port); ethClient.println(postAPI.port);
ethClient.println("Content-Type: application/json"); ethClient.println("Content-Type: application/json");
ethClient.print("Content-Length: "); ethClient.print("Content-Length: ");
ethClient.println(measureJsonPretty(json)); ethClient.println(measureJson(json));
ethClient.println("Connection: close"); ethClient.println("Connection: close");
ethClient.println(); ethClient.println();
serializeJson(json, ethClient); serializeJson(json, ethClient);

View File

@ -51,6 +51,7 @@ http {
location / { location / {
proxy_pass http://bite; proxy_pass http://bite;
proxy_http_version 1.1;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Host $host:$server_port;
@ -59,6 +60,9 @@ http {
proxy_read_timeout 300; proxy_read_timeout 300;
proxy_connect_timeout 300; proxy_connect_timeout 300;
## !- This is mandatory for IoT that do not wait for a reply -! ##
proxy_ignore_client_abort on;
} }
location /mqtt { location /mqtt {