Project

General

Profile

Actions

Feature #852

closed

Implement cross domain javascript API

Added by daniel magnusson about 13 years ago. Updated almost 10 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
User Interface
Target version:
-
Start date:
2012-01-24
Due date:
% Done:

0%

Estimated time:

Description

I want to create a stand alone javascript app that runs on another server(or device, or port..). Need cross domain requests for ajax.

Pretty small change but not sure about the security implications.

It's covered here; http://enable-cors.org/

Diff to make it all work;

--- a/src/http.c
+++ b/src/http.c
@@ -166,6 +166,9 @@ http_send_header(http_connection_t *hc, int rc, const char *content,
          rc, http_rc2str(rc));

   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) {
     htsbuf_qprintf(&hdrs, "Cache-Control: no-cache\r\n");

Actions

Also available in: Atom PDF