# WowzaStreamingEngine needs CORS header sent on playlist.m3u8

**URL:** <https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748>\
**Category:** Wowza Streaming Engine\
**Created:** [April 10, 2014, 1:38am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748 "2014-04-10T01:38:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Anderson1](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@John\_Anderson1](https://community.wowza.com/u/John_Anderson1)\
**Post date:** [April 10, 2014, 1:38am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/1 "2014-04-10T01:38:14Z")

</div>

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.

> [@Possible to add HTTP header to the playlis and mainfest requests](http://community.wowza.com/t/-/37658):
>
> Is it possible to add a HTTP header to the playlist and manifest requests? I’ve done some testing with a HTTP proxy between and custom headers that I’m trying to keep for the whole session get lost on the playlist/manifest requests. If that is not possible - can I set a “server wide” header for all HTTP respones? Tried all I could find in IHTTPStreamerCupertinoVODActionNotify2, IMediaListProvider, IMediaListReader and then onHTTPSessionCreate etc… but they are all called after the first playlis…

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

```auto
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/

```auto
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

```auto
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.vermontinternetdesign.com) [http://www.vtwe.com](http://www.vtwe.com)

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [April 10, 2014, 9:24pm UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/2 "2014-04-10T21:24:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Andrew\_Kennedy1](https://community.wowza.com/u/Andrew_Kennedy1)\
**Post date:** [April 10, 2014, 5:54am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/3 "2014-04-10T05:54:42Z")

</div>

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.

cupertinoUserHTTPHeaders

Access-Control-Allow-Origin: \*

If you want multiple headers do

cupertinoUserHTTPHeaders

Access-Control-Allow-Origin: \*|AnotherHeaderToReturn: Me

No need for any code.

Andrew.

---

<div class="post-metadata">

**Author:** ![John\_Anderson1](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@John\_Anderson1](https://community.wowza.com/u/John_Anderson1)\
**Post date:** [April 10, 2014, 5:47am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/4 "2014-04-10T05:47:20Z")

</div>

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.

```auto
 <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>

```

> 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.

---

<div class="post-metadata">

**Author:** ![John\_Anderson1](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@John\_Anderson1](https://community.wowza.com/u/John_Anderson1)\
**Post date:** [April 10, 2014, 9:08am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/5 "2014-04-10T09:08:27Z")

</div>

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

> 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.
> 
> cupertinoUserHTTPHeaders
> 
> Access-Control-Allow-Origin: \*
> 
> If you want multiple headers do
> 
> cupertinoUserHTTPHeaders
> 
> Access-Control-Allow-Origin: \*|AnotherHeaderToReturn: Me
> 
> No need for any code.
> 
> Andrew.

---

<div class="post-metadata">

**Author:** ![John\_Anderson1](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@John\_Anderson1](https://community.wowza.com/u/John_Anderson1)\
**Post date:** [April 16, 2014, 10:43am UTC](https://community.wowza.com/t/wowzastreamingengine-needs-cors-header-sent-on-playlist-m3u8/42748/6 "2014-04-16T10:43:15Z")

</div>

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?
