title: How to proxy a HTTP video stream to any amount of clients through a Spring Webserver
body: <p>Provided that I have a video HTTP stream broadcasted on a server that is on the same network as my Spring Webserver is, for instance in some url such as:</p>
  
  <blockquote>
    <p><a href="http://localhost:9090/httpstream" rel="noreferrer">http://localhost:9090/httpstream</a></p>
  </blockquote>
  
  <p>How can I proxy this video stream to any amount of clients, using Spring?
  The following example demonstrates the wanted flow:</p>
  
  <ol>
  <li>Spring webserver can be found at <a href="http://localhost:9091/spring" rel="noreferrer">http://localhost:9091/spring</a></li>
  <li>A client wants to access a video stream, so he connects his video-stream-player to <a href="http://localhost:9091/spring" rel="noreferrer">http://localhost:9091/spring</a> (the spring webserver)</li>
  <li>The Spring WebServer should redirect the stream found on <a href="http://localhost:9090/httpstream" rel="noreferrer">http://localhost:9090/httpstream</a> to the client, with the latter never knowing that he accessed the httpstream host. The connection is made by Spring, not by the client</li>
  </ol>
  
  <p>This is needed because the HTTPStream is an unsecured and not authenticated host, and I wanted to wrap it around a <code>Spring Webserver</code>, so that I could use some form of Security, such as a <code>Basic Auth</code>.</p>
  
  <hr>
  
  <p>I tried requesting some form of mapping, but I couldn't find what kind of object to return, nor how to make the connection, but the expected behaviour should be something like this:</p>
  
  <pre><code>@Controller
  public class HttpStreamProxyController {
  
      @RequestMapping("/spring") {
      public /*Stream Object?*/ getSecuredHttpStream() {
         if (clientIsSecured) {
         //... Security information
  
         return   //What should be returned?
         }
     }
  }
  </code></pre>