Im developing a tool in javascript that will get information from a embedded HTTP server on an external controller and display it onto a web page, i'm new to HTTP requests and have successfully followed tutorials but now i'm lost as to what to do. i have used google dev tools to monitor the traffic and i'm trying to replicate how the information is requested. The issue is i cannot seem to get the same response, i can get chrome to request the file from the controller (csv file) but when i try to use the same request headers i hit the CORS issue that i have seen on a few threads but not sure what the difference between chrome requesting the info and the script requesting the info as i understand its the server side that blocks it?
this is the header when chrome requests the file and receives it successfully
General Request URL: http://172.20.25.11/getvar.csv Request Method: GET Status Code: 200 OK Remote Address: 172.20.25.11:80 Referrer Policy: no-referrer-when-downgrade Response Header Cache-Control: no-cache Content-Type: text/csv; charset="utf-8" Expires: 1 JAN 2013 00:00:00 GMT Last-Modified: 27 AUG 2020 15:40:07 GMT Server: embedded HTTPD Transfer-Encoding: chunked Request Header GET /getvar.csv HTTP/1.1 Host: 172.20.25.11 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 If-Modified-Since: 27 AUG 2020 15:32:21 GMT
is there any way i can write a XMLHttpRequest() or fetch() request where i can retrieve and parse this file?
Thanks in advance