Results 1 to 6 of 6

Thread: WowzaStreamingEngine needs CORS header sent on playlist.m3u8

  1. #1
    Join Date
    Apr 2014
    Posts
    8

    Exclamation WowzaStreamingEngine needs CORS header sent on playlist.m3u8

    Hi I am trying to figure out a way to add a simple header Access-Control-Allow-Origin: "*" to the playlist.m3u8 and other playlist files or the whole server for that matter, whatever works as long as I can set the header. I am using WowzaStreamingEngine-4.0.3 and I simply need to add a cors header to the playlist file, the connections on port 1935, or any request to the wowza client. I found a few other threads that look like they would work, just not quite. I tried to add a new .jar file to the server /lib/ module and enable it in the back end of the server. Kind of like what this guy is doing here.

    http://www.wowza.com/forums/showthre...nfest-requests

    I created a file called headers.class which contains this code.

    package com.vermontinternetdesign.module; 
     
    import com.wowza.wms.module.*; 
    import com.wowza.wms.client.*; 
    import com.wowza.wms.amf.*; 
    import com.wowza.wms.request.*; 
     
    public class httpHeader extends ModuleBase 
    { 
     public void onAppStart(IApplicationInstance appInstance) 
     { 
         
     } 
     public void onHTTPSessionCreate(IHTTPStreamerSession httpSession){
    	getLogger().info("ModuleHTTPTestPlayStart.onHTTPSessionCreate: "+httpSession.getSessionId());
    	httpSession.setUserHTTPHeader("WowzaTestHeader", "Wowza Rocks");
     }
     public void doSomething(IClient client, RequestFunction function, 
     AMFDataList params) 
     { 
     
     } 
    }
    then I created a .jar file using this command from inside the /lib/

    jar cf httpHeader.jar headers.class
    Than I went to the application in the admin section and added a module
    named httpHeader and gave it a qualified class name of
    com.vermontinternetdesign.module.httpHeader
    This did not produce a header for me unfortunely.

    We are working on a very important project with the WowzaStreamingEngine however, I have tried 50 different ways to sunday in order to get a simple header sent so that I can access the playlist through an ajax request. Seems like a pretty remedial feature which should have a simple way to turn a cors header on and off. As the WowzaStreamingEngine is about useless to us if we cannot find a solution to this. I am not a Java programmer, I am a php programmer. However, if someone can show me a step by step way of adding this header to Wowza then the software will be very useful to me and I promise to recommend wowza to my future clients. I really don't want to have to switch to another Engine at this point in time. As adding a header to a request is usually a very simple procedure. Thank you for reading this and I hope someone can point me in the right direction. I have already looked the internet up and down and looked at the other threads. None of which helped me solve the problem. They pointed me in the right direction. However, I still don't have a header and this is holding up an entire project and client is getting ancy because I recommended this software. Not thinking it was going to take an act of God to display a cors header.The crossdoman.xml and accesspolicy.xml are all set up to allow these connections. All I need to know is how to send a header any header and that is it. I don't program in Java but, I do program in other languages so I need a step by step thank you very much and if you can provide a solution for me. I might love you so much that I will give you some paid work to do. As I have several other people who want similar systems set up, and if we can get past this issue. It will generate a lot of work to do.

    Thank you In advance,
    John Anderson
    http://www.vermontinternetdesign.com http://www.vtwe.com
    Last edited by chillininvt; 04-09-2014 at 11:40 PM. Reason: mistake

  2. #2

    Default

    Hi John,

    The setUserHTTPHeader method is the correct one to use for this purpose.

    To debug, check the log files and see if your module method is being called when you make the connection.

    You should see the ModuleHTTPTestPlayStart.onHTTPSessionCreate: message logged along with the session id.

    Also look for logging errors that may point to the problem. Look for errors related to not being able to load the class or xml errors.

    Please post the relevant parts of your log files and Application.xml which would assist in diagnosing the issue.

    Roger.

  3. #3
    Join Date
    Apr 2014
    Posts
    8

    Default

    I don't see any relevant errors in the wowzastreamingengine_error.log or _access.log in the Application.xml I can see this section has a reference to the class. Is there another log that I should be looking in? Or a better way to tell if the module is being lodaded.

     <Modules>
                            <Module>
                                    <Name>base</Name>
                                    <Description>Base</Description>
                                    <Class>com.wowza.wms.module.ModuleCore</Class>
                            </Module>
                            <Module>
                                    <Name>logging</Name>
                                    <Description>Client Logging</Description>
                                    <Class>com.wowza.wms.module.ModuleClientLogging</Class>
                            </Module>
                            <Module>
                                    <Name>httpHeader</Name>
                                    <Description>CORS HEADER</Description>
                                    <Class>com.vermontinternetdesign.module.httpHeader</Class>
                            </Module>
                            <Module>
                                    <Name>flvplayback</Name>
                                    <Description>FLVPlayback</Description>
                                    <Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
                            </Module>
                            <Module>
                                    <Name>ModuleCoreSecurity</Name>
                                    <Description>Core Security Module for Applications</Description>
                                    <Class>com.wowza.wms.security.ModuleCoreSecurity</Class>
                            </Module>
                    </Modules>

    Quote Originally Posted by roger_l View Post
    Hi John,

    The setUserHTTPHeader method is the correct one to use for this purpose.

    To debug, check the log files and see if your module method is being called when you make the connection.

    You should see the ModuleHTTPTestPlayStart.onHTTPSessionCreate: message logged along with the session id.

    Also look for logging errors that may point to the problem. Look for errors related to not being able to load the class or xml errors.

    Please post the relevant parts of your log files and Application.xml which would assist in diagnosing the issue.

    Roger.

  4. #4

    Default

    Hi,

    As long as you are using Wowza 3.5 or above then you can add a property in your Application.xml by under HTTPStreams/Properties container.

    <Property>
    <Name>cupertinoUserHTTPHeaders</Name>
    <Value>Access-Control-Allow-Origin: *</Value>
    </Property>

    If you want multiple headers do

    <Property>
    <Name>cupertinoUserHTTPHeaders</Name>
    <Value>Access-Control-Allow-Origin: *|AnotherHeaderToReturn: Me</Value>
    </Property>

    No need for any code.

    Andrew.

  5. #5
    Join Date
    Apr 2014
    Posts
    8

    Red face Solved

    That worked great! Thanx. I bet adding that into the documentation will save the next person like me a lot of time.

    Quote Originally Posted by andrew_k View Post
    Hi,

    As long as you are using Wowza 3.5 or above then you can add a property in your Application.xml by under HTTPStreams/Properties container.

    <Property>
    <Name>cupertinoUserHTTPHeaders</Name>
    <Value>Access-Control-Allow-Origin: *</Value>
    </Property>

    If you want multiple headers do

    <Property>
    <Name>cupertinoUserHTTPHeaders</Name>
    <Value>Access-Control-Allow-Origin: *|AnotherHeaderToReturn: Me</Value>
    </Property>

    No need for any code.

    Andrew.

  6. #6
    Join Date
    Apr 2014
    Posts
    8

    Default

    This appears to work. However one problem that I am having is that one of the TS segments is coming through without the header. The other3 are coming through with the header just fine. Just one of the segments is not. Any ideas?

Similar Threads

  1. Load Balancer module CORS header
    By arpan_synapse in forum General Forum
    Replies: 12
    Last Post: 05-30-2016, 04:11 AM
  2. playlist.m3u8 not immediately available
    By Claudijo in forum AddOn: Transcoder
    Replies: 7
    Last Post: 01-24-2013, 06:51 AM
  3. playlist.m3u8 not same
    By kbosnjak in forum Live Streaming and Encoder Discussion
    Replies: 6
    Last Post: 12-05-2011, 10:56 PM
  4. Replies: 5
    Last Post: 11-16-2011, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •