Wowza Community

Custom cache control when serving crossdomain.xml ??

Hi!

I’d like to specify the cache-control header when serving the crossdomain.xml file.

I tried doing a HTTPProvider that builds and sends this file. However it seems that it always takes the file in the conf directory.

Here’s my VHost.xml configuration for that HTTPProvider:

<HTTPProviders>
    <HTTPProvider>
        <BaseClass>com.custom.http.HTTPCrossdomain</BaseClass>
        <RequestFilters>*crossdomain.xml</RequestFilters>
	<AuthenticationMethod>none</AuthenticationMethod>
    </HTTPProvider>
(...)
</HTTPProviders>

And the HTTPProvider Code (is in another package so it doesn’t collide with wowza.wms)

public class HTTPCrossdomain extends HTTProvider2Base {
	
	public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
		if (!doHTTPAuthentication(vhost, req, resp))
			return;
		
		StringBuffer response = new StringBuffer();
		response.append("<?xml version=\"1.0\"?>");
		response.append("<!DOCTYPE cross-domain-policy SYSTEM \"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd\">");
		response.append("<cross-domain-policy>");
		response.append("<allow-access-from domain=\"*\"/>");
		response.append("<site-control permitted-cross-domain-policies=\"all\"/>");
		response.append("</cross-domain-policy>");
		try {
			resp.setHeader("Content-Type", "text/xml");
			resp.setHeader("Cache-Control", "foo");
			
			OutputStream out = resp.getOutputStream();
			byte[] outBytes = response.toString().getBytes();
			out.write(outBytes);
		} catch (Exception e) {
			WMSLoggerFactory.getLogger(null).error(
					"ERROR: " + e.toString());
		}
	}
}

I’ve tried removing the file at the conf directory but then the server responds with 404. It doesn’t take in consideration the HTTPProvider one :confused:

Any help?

Trying that out, not getting it to work either quite yet. I’ll look more.

Richard

Getting back to this with more tests, I can confirm. Your HTTPProvider does not run in the 1935 HostPort with RequestFilter “crossdomain.xml", but it does run with any other RequestFilter, and it does run in the 8086 HostPort with RequestFilter ".crossdomain.xml”.

We’ve been digging in and are seeing where the issue is, but have a few steps as yet to sort out and take direction to fix. I will update you with any further info, temporary work-around perhaps or patch.

Thanks for the report,

Richard

Hello, is that issue resolved? I can confirm with Wowza Streaming Engine 4.2.0 that “*crossdomain.xml” filter isn’t working.

2 years have passed and still that “*crossdomain.xml” custom HTTP provider isn’t working with Wowza Streaming Engine 4.6.0… @Richard Lanham are you able to deliver some workaround to set custom cache headers for crossdomain.xml requests?