title: Receive HLS stream and rebroadcast
body: <p>I have commercial streaming server that streams via HLS in Europe.</p>
  <p><code>http://europe.server/stream1/index.m3u8</code></p>
  <p>Now my clients in USA having some network issues due to distance.</p>
  <p>So I have deployed new server in USA. I'd like it to receive HLS streams from European server and respond to US based customers.</p>
  <p>So users can access like</p>
  <p><code>http://usa.server/stream1/index.m3u8</code></p>
  <p>It will be H265/HEVC only so RTMP is not possible. Every tutorial I see on internet is based on RTMP.</p>
  <p>I have used following config from <a href="https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/" rel="nofollow noreferrer">https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/</a> for reference.</p>
  <pre><code>worker_processes  auto;
  events {
      worker_connections  1024;
  }
  
  http {
      sendfile off;
      tcp_nopush on;
      aio on;
      directio 512;
      default_type application/octet-stream;
      
      server {
          listen 8080;
  
          location / {
              # Disable cache
              add_header 'Cache-Control' 'no-cache';
              
              # CORS setup
              add_header 'Access-Control-Allow-Origin' '*' always;
              add_header 'Access-Control-Expose-Headers' 'Content-Length';
              
              # allow CORS preflight requests
              if ($request_method = 'OPTIONS') {
                  add_header 'Access-Control-Allow-Origin' '*';
                  add_header 'Access-Control-Max-Age' 1728000;
                  add_header 'Content-Type' 'text/plain charset=UTF-8';
                  add_header 'Content-Length' 0;
                  return 204;
              }   
              
              types {
                  application/dash+xml mpd;
                  application/vnd.apple.mpegurl m3u8;
                  video/mp2t ts;
              }   
              
              root /mnt/;
          }   
      }
  }
  </code></pre>