title: Dash Live Streaming on Nginx 404 Not Found on Cross Origin Request
body: <p>I want to set up a Dash Live Streaming nginx server to stream to a node.js app. I am new to nginx so tried finding the solution a lot, but no luck. I have all the required modules installed and I want to display the dash stream via Shaka Player.</p>
  
  <p>My nginx server is running on port 8080 and my node.js app is running on port 3000. I configured the server such that anyone on the Local Area Network can stream to this server via OBS. It is getting and storing the stream files properly. But every time my node app requests for the .mpd via shaka player, it displays:</p>
  
  <p><strong>GET <a href="http://192.168.0.107/dash/test.mpd" rel="nofollow noreferrer">http://192.168.0.107/dash/test.mpd</a></strong></p>
  
  <p><strong>net::ERR_CONNECTION_REFUSED</strong></p>
  
  <p>The Shaka Player script displays error 1002, which I found to be related to CORS. I tried so so many ways to Allow Cross Origin Request but none worked. Here is my current nginx.config file:</p>
  
  <pre><code>worker_processes  1;
  
  events {
      worker_connections  1024;
  }
  
  
  http {
      include       mime.types;
      default_type  application/octet-stream;
  
      sendfile        on;
      tcp_nopush     on;
  
      keepalive_timeout  65;
  
      server {
          listen  8080;
  
          location / {
              root   html;
              index  index.html index.htm;
          }
  
          location /dash {
              add_header Access-Control-Allow-Origin * always;
              add_header Cache-Control no-cache always;
  
              root usr/local/nginx/stream/dash;
          }
      }
  }
  
  rtmp {
      server {
          listen 1935;
          chunk_size 4096;
  
          application dash {
              live on;
              record off;
  
              dash on;
              dash_nested on;
              dash_path usr/local/nginx/stream/dash;
              dash_fragment 3;
              dash_playlist_length 120;
              dash_cleanup on;
          }
      }
  }
  </code></pre>
  
  <p>My current nginx version is 1.15.7. I tested both on windows and Ubuntu 17.10, with other versions too. I was unable to fix the problem.</p>
  
  <p>I also want to know whether add_header arguments need to be within quotes or not because I saw both versions on different places.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Changed request url to <a href="http://192.168.0.107:8080/dash/test/index.mpd" rel="nofollow noreferrer">http://192.168.0.107:8080/dash/test/index.mpd</a> and <a href="http://192.168.0.107:8080/dash/test.mpd" rel="nofollow noreferrer">http://192.168.0.107:8080/dash/test.mpd</a>, changed nginx.conf /dash root to usr/local/nginx/stream/dash and usr/local/nginx/stream but none worked. </p>