Hello
I am trying to send a GET request to RYU api
Server running RYU controller
http://192.168.52.142:8080/stats/switches
When i send this request from a web browser or through POSTMAN application
i get the response.

But when i try to use a javaScript i get CORS error.
*Access to XMLHttpRequest at 'http://192.168.52.142:8080/stats/switches
<http://192.168.52.142:8080/stats/switches>' from origin 'null' has been
blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present
on the requested resource.*

I am new to javascripting and I am unable to resolve this issue. I am
posting my Java script along with the headers that i receive in response.
Can someone help me resolve this issue/

[image: image.png]


function switchCount(){
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://192.168.52.142:8080/stats/switches";, true);
xhttp.send();
//when xhttp state changes
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// Typical action to be performed when the document is ready:
console.log('Request Successful');
http_request.withCredentials = true;
document.getElementById("flowrule").innerHTML = xhttp.responseText;
}
};
}
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to