So weird I can't make the most basic GET-request, without authentication or JSON.
I just try to call an URL, which works great with Postman / Browser, but not with Arduino; even witht the tons of examples.
Sorry I found something.
Apparently there were issues with the Host header..
I played with it, and added it now before making the GET-request
Now I get a 200 result and no error in the external log file, but it loads the html page source?
Starting connection to server...
connected to server
HTTP/1.1 200 OK
Host:
Server: MADRIX
Last-Modified: Fri, 26 May 2023 12:08:18 GMT
Content-Type: text/html
Content-Length: 22338
Cache-Control: max-age=0
<!doctype html>
<html lang="eng">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="expires" content="0">
<meta name="robots" content="noindex, nofollow">
<title>MADRIX 5 on Dynamic</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon.png">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="madrixremote.js"></script>
</head>
<body onload="initGui()">
<noscript><strong>JavaScript is required to use this website for the MADRIX HTTP Remote Control! Please enable it in order to continue.</strong></noscript>
<header>
<svg class="mlogo" viewBox="0 0 1134 426">
<desc>MADRIX Lighting Control</desc>
<g class="mlogo-icon">
<path d="M164.766,225.21c-8.055,-2.435 -15.73,-4.871 -23.034,-7.498l0,15.563c7.868,2.441 16.292,4.687 25.279,6.75c27.712,6.56 60.475,11.625 99.977,14.621c5.246,0.562 10.862,0.939 16.477,1.312l0,-8.433c-5.615,-0.75 -11.231,-1.317 -16.477,-2.061c-40.625,-5.252 -74.138,-12 -102.222,-20.254Z"/>
<path d="M153.155,250.521c-3.93,-0.934 -7.675,-1.873 -11.423,-2.811l0,36.558l141.733,0l0,-16.309c-5.617,-0.375 -11.231,-0.748 -16.477,-1.125c-44.744,-3.377 -82.002,-8.812 -113.833,-16.313Z"/>
<path d="M183.675,200.091c-16.29,-6.373 -30.142,-13.123 -41.943,-20.248l0,21.561c11.612,5.064 24.715,9.748 39.323,13.873c23.776,7.125 52.05,12.937 85.933,17.625c5.246,0.75 10.862,1.498 16.477,2.062l0,-8.437c-5.615,-0.94 -11.231,-2.063 -16.477,-3.186c-33.324,-6.939 -60.662,-14.625 -83.313,-23.25Z"/>
<path d="M207.08,177.594c-23.031,-10.875 -40.069,-22.686 -52.803,-35.059l-12.545,0l0,13.684c14.979,12.939 34.45,24.749 61.041,35.062c17.973,6.746 38.942,13.121 64.215,18.748c5.246,1.312 10.862,2.435 16.477,3.56l0,-9.562c-5.8,-1.498 -11.231,-2.998 -16.477,-4.496c-23.588,-6.94 -43.245,-14.247 -59.908,-21.937Z"/>
<path d="M266.988,142.535l-16.662,0c3.372,2.25 7.115,4.502 10.86,6.752c1.873,1.121 3.749,2.059 5.802,3.184c5.058,2.811 10.491,5.437 16.477,8.25l0,-18.186l-16.477,0Z"/>
<path d="M238.345,156.219c-7.861,-4.496 -14.602,-8.998 -20.595,-13.684l-32.391,0c10.862,9.559 24.712,18.557 42.69,26.995c11.232,5.25 24.151,10.313 38.939,15.188c5.246,1.688 10.677,3.373 16.477,5.063l0,-12.376c-5.8,-2.248 -11.419,-4.497 -16.477,-6.748c-10.668,-4.686 -20.215,-9.375 -28.643,-14.438Z"/>
</g>
<g class="logo-text">
<path d="M322.475,275.84l23.227,0l0,8.438l-33.891,0l0,-34.899l10.664,0l0,26.461Z"/>
<rect x="350.319" y="249.379" width="10.664" height="34.899"/>
<path d="M401.554,261.965l0,-0.094c0,-1.608 -0.485,-2.711 -1.453
disconnecting from server.
So it's not working yet, but getting closer.
it loads the server HTML source, so it doesn't add the path...
As in all examples host is after the request, so it should work.
However; whenever setting the host after the request I end up with statuscode 400 again, as well as Madrix log displaying an error host is missing in http header
it doesn't like the IP as "Host"? try your servers name
Yes, I've tried several.
"Host: Dynamic"
-- which is the actual hostname on the server
"Host: MADRIX
-- which is the actual servername on the server
"Host: MADRIX 5"
-- which is the actual hostlabel on the server
"Host: 192.168.2.198"
-- what would make sense
"Host: "Nano33IoT"
-- just as test
I've also tried to set the hostname of the Nano - board. Unfortunately also without luck.
I was expecting this might work since when I scan the Nano device through a network scanner no hostname is defined.
WiFi.setHostname("Nano-33-IoT");
Unfortunately, when I scanned after adding this code, the hostname of the board was not updated.
After many testing I decided to change the board.
Now it works! I'm using a simple NodeMCU - 8266 board which made it possible to use different libraries.
Still hoping if someone knows what's missing on the ArduinoHttpClient library to do this properly
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.