HTTP Provider to redirect customers to your website

This is a small http provider that will allow you to redirect customers to a sepcified URL instead of displaying the current Wowza Streaming Engine version.

Set this up in your conf/VHost.xml just before the com.wowza.wms.http.HTTPServerVersion provider within the 8086 port as follows:

<HTTPProvider>
<BaseClass>guru.thewowza.example.httpprovider.website.Redirection</BaseClass>
<RequestFilters>meta*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

You will also need to add a property into the last Properties section of your VHost.xml file

<Property>
<Name>wowzaGuruRedirectHTTPWebURL</Name>
<Value>http://www.yourwebsiteurlhere.com</Value>
<Type>String</Type>
</Property>

This property allows you to set the URL where the request will be redirected to. If this is not set it defaults to http://thewowza.guru.

You can compile from the source below or download the zip file which has a jar file within it.

Redirection Class

package guru.thewowza.example.httpprovider.website;

import com.wowza.wms.http.*;
import com.wowza.wms.vhost.*;

public class Redirection extends HTTProvider2Base
	{
	public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp)
		{
		if (!doHTTPAuthentication(vhost, req, resp))
			return;
		String destinationURL = vhost.getProperties().getPropertyStr("wowzaGuruRedirectHTTPWebURL", "http://thewowza.guru");
		resp.setResponseCode(302);
		resp.setHeader("Location", destinationURL);
		}
	}

You can download the zip file here.


Comments are closed.