Adding CORS headers to the REST api (#42)

* Adding CORS headers to default replies

* adding CORS headers and set payload OK for options method
3.56-maint
Justin Richards 2 years ago committed by GitHub
parent a4d6857922
commit a64dfa38fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -156,6 +156,17 @@ namespace network
}
//what = matcher.first;
// ensure CORS headers are added
reply.headers.add("Access-Control-Allow-Origin", "*");
reply.headers.add("Access-Control-Allow-Methods", "*");
reply.headers.add("Access-Control-Allow-Headers", "*");
if (request.method == HTTP_OPTIONS) {
reply.status = http::HTTPPayload::OK;
}
matcher.second->handleRequest(request, reply, what);
return;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.