Access-Control-Allow-Origin
Question
motion.conf on thread1.conf:
videodevice /dev/video0
text_left CAMERA 1
target_dir /home/pi/webcam/camera1
stream_port 9061
stream_auth_method 1
stream_authentication video0:sHs9061abc
Call with
XMLHttpRequest :
var url = "http://10.16.1.65:9061/stream.mjpeg";
var method = "POST"
var xhr = new
XMLHttpRequest ();
xhr.open(method, url, true);
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('video0:sHs9061abc'));
xhr.send();
Error Output on Console :
XMLHttpRequest cannot load
http://10.16.1.65:9061/stream.mjpeg. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'file://' is therefore not allowed access. The response had HTTP status code 501.
Please give me solution, Thanks
motion.conf on thread1.conf:
------------------------------------
videodevice /dev/video0
text_left CAMERA 1
target_dir /home/pi/webcam/camera1
stream_port 9061
stream_auth_method 1
stream_authentication video0:sHs9061abc
Call with XMLHttpRequest :
----------------------------------
var url = "http://10.16.1.65:9061/stream.mjpeg";
var method = "POST"
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('video0:sHs9061abc'));
xhr.send();
Error Output on Console :
-------------------------------
XMLHttpRequest cannot load http://10.16.1.65:9061/stream.mjpeg. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'file://' is therefore not allowed access. The response had HTTP status code 501.
Environment
Motion version: |
3.2.12 |
ffmpeg version: |
|
Libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
Raspbian Jessie |
--
SuburSubekti - 21 Mar 2017
Answer