diff --git a/include/mgos_http_server.h b/include/mgos_http_server.h index b97aea5..d69d7b1 100644 --- a/include/mgos_http_server.h +++ b/include/mgos_http_server.h @@ -68,6 +68,11 @@ void mgos_register_http_endpoint_opt(const char *uri_path, * static server (404 will be returned). */ void mgos_http_server_set_document_root(const char *document_root); + +/* + * Set extra headres to serve. (e.g cors heeaders) + */ +void mgos_http_server_set_extra_headers(const char *extra_headers); #if defined(__cplusplus) } diff --git a/src/mgos_http_server.c b/src/mgos_http_server.c index cc76c29..e3fed95 100644 --- a/src/mgos_http_server.c +++ b/src/mgos_http_server.c @@ -385,3 +385,7 @@ struct mg_connection *mgos_get_sys_http_server(void) { void mgos_http_server_set_document_root(const char *document_root) { s_http_server_opts.document_root = document_root; } + +void mgos_http_server_set_extra_headers(const char *extra_headers) { + s_http_server_opts.extra_headers = extra_headers; +}