Results 1 to 2 of 2

Thread: Redirect HTTP requests with a HTTPProvider

  1. #1

    Default Redirect HTTP requests with a HTTPProvider

    Hi,

    Since I had to do it to meet a client need and as I have not found anything similar on the forum I am posting a HTTPProvider allowing to redirect HTTP requests coming to Wowza to another domain/IP (this is based on a given filter in the incoming URL). In my case I needed to redirect .html, .js, .css ... files. We were switching from one server/IP + Apache on port 80 + Wowza on port 1935 => 2 IPs having both Wowza and Apache on port 80 on the same server.

    package com.wowza.wms.http;
    
    import com.wowza.wms.logging.*;
    import com.wowza.wms.vhost.*;
    
    public class RedirectThis extends HTTProvider2Base {
    	 public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
    		if (!doHTTPAuthentication(vhost, req, resp))
    		         return;
    		resp.setResponseCode(302);
    		resp.setHeader("Location", "http://<your new IP or domain>"+req.getRequestURI());
    		WMSLoggerFactory.getLogger(null).info("This is a redirect to: http://<your new IP or domain>"+req.getRequestURI());
     	}
    }

    VHost.xml
    <HTTPProvider>
    <BaseClass>com.wowza.wms.http.RedirectThis</BaseClass>
    <RequestFilters>yourfilter*</RequestFilters>
    <AuthenticationMethod>none</AuthenticationMethod>
    </HTTPProvider>

    Using getRequestURI() will pass on anything after domain/IP including query string to the new domain/IP. This is a very basic example but I hope it can help someone trying to achieve the same result.

    Thanks
    Arnaud

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    Hello Arnaud,

    This concept should be possible however I'd suggest looking at our HTTP/RTSP redirection article as a different approach.

    Thanks,

    Matt

Similar Threads

  1. Wowza 2 to redirect RTMP requests to another server
    By ooBaeD0mi8ie in forum Server Administration Discussion
    Replies: 2
    Last Post: 01-15-2013, 12:52 AM
  2. RTMPT http tunneling result very high http get requests
    By qstream in forum Performance Tuning Discussion
    Replies: 2
    Last Post: 09-10-2012, 09:39 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
  •