I have a index.html file that send request to server. On the Arduino code I receive the request and i want to respond back to the webpage.
I get the following error on the browser: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
For what i have understood, the problem is that, when sending a request to the browser we have to “Access-Control-Allow-Origin ” and one way to do it would be to add an Header to the response on the arduino for example:
response->addHeader("Access-Control-Allow-Origin", "*"); request->send(response);
However, so far i didnt manage to find a way to add an header to the response using the PsychicHttp.h library.
So far i have this:
server.on("/", HTTP_GET, [](PsychicRequest *request){ String output = "Hello world"; return request->reply(output.c_str()); });
Thank you for the help
Ariana Marta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.