[httpd] Allow cross origin POST, PUT, DELETE, OPTIONS requests

If the web interface is hosted on a different server, this is required
to allow sending e. g. post/put requests to control outputs.
This commit is contained in:
chme 2018-03-01 06:37:14 +01:00
parent a764fb3c52
commit d59e62312a

View File

@ -743,9 +743,7 @@ httpd_gen_cb(struct evhttp_request *req, void *arg)
output_headers = evhttp_request_get_output_headers(req);
evhttp_add_header(output_headers, "Access-Control-Allow-Origin", allow_origin);
// Allow only GET method and authorization header in cross origin requests
evhttp_add_header(output_headers, "Access-Control-Allow-Method", "GET");
evhttp_add_header(output_headers, "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
evhttp_add_header(output_headers, "Access-Control-Allow-Headers", "authorization");
// In this case there is no reason to go through httpd_send_reply