Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding CORS headers
Hi,

This implements

https://tvheadend.org/issues/852

I'm currently building a web UI and I want it to be static HTML no server side code.

Thanks
  • Loading branch information
joshdvir authored and perexg committed Sep 18, 2015
1 parent 10e8225 commit febb1c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/http.c
Expand Up @@ -235,9 +235,13 @@ http_send_header(http_connection_t *hc, int rc, const char *content,
htsbuf_qprintf(&hdrs, "%s %d %s\r\n",
http_ver2str(hc->hc_version), rc, http_rc2str(rc));

if (hc->hc_version != RTSP_VERSION_1_0)
if (hc->hc_version != RTSP_VERSION_1_0){
htsbuf_qprintf(&hdrs, "Server: HTS/tvheadend\r\n");

htsbuf_qprintf(&hdrs, "Access-Control-Allow-Origin: *\r\n");
htsbuf_qprintf(&hdrs, "Access-Control-Allow-Methods: POST, GET\r\n");
htsbuf_qprintf(&hdrs, "Access-Control-Allow-Headers: x-requested-with\r\n");
}

if(maxage == 0) {
if (hc->hc_version != RTSP_VERSION_1_0)
htsbuf_qprintf(&hdrs, "Cache-Control: no-cache\r\n");
Expand Down

0 comments on commit febb1c1

Please sign in to comment.