Allow cross origin access control
TODO the origin (*) should be taken from configuration in order to restrict it.
@@ -7891,7 +7891,7 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
stream << "Access-Control-Allow-Origin: *\r\n";
stream << "Access-Control-Allow-Credentials: true\r\n";
stream << "Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE\r\n";
- stream << "Access-Control-Allow-Headers: Content-Type\r\n";
+ stream << "Access-Control-Allow-Headers: Access-Control-Allow-Origin, Content-Type\r\n";
stream << "Content-Type: text/html\r\n";
stream << "Content-Length: 0\r\n";
stream << "Gateway-Name: " << d->gwName << "\r\n";
@@ -8032,6 +8032,7 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
}
stream << "HTTP/1.1 " << rsp.httpStatus << "\r\n";
+ stream << "Access-Control-Allow-Origin: *\r\n";
stream << "Content-Type: " << rsp.contentType << "\r\n";
stream << "Content-Length:" << QString::number(str.toUtf8().size()) << "\r\n";
