Proxying

If you are already running a web server and you want Restreamer to be part of the website, you can forward requests to a specific location to your Restreamer.

Below you will find example configuration snippets for nginx, Apache, and Caddy. All of these allow proxying requests to a specific location to your Restreamer. These examples assume that Restreamer is running on the same server or in a trusted local network accessible by your server. In this case HTTPS doesn't need to be enabled in Restreamer. Your nginx, Apache, or Caddy needs to be configured for HTTPS instead.

NGINX

Example 1: nginx is serving your website and you want access Restreamer at /restreamer/. Restreamer is running on the same server at β€œ127.0.0.1:8080”:

http {
    server {
        listen 80;
        server_name ...;

        [your site configuration]

        location /restreamer/ {
            proxy_http_version 1.1;
            proxy_pass http://127.0.0.1:8080/;
            proxy_redirect off;
        }
    }
}

Example 2: nginx is serving your website and you want access multiple Restreamer at /restreamer1/, /restreamer2/, and /restreamer3/. All Restreamer are in a local network that is connected to your server:

http {
    server {
        listen 80;
        server_name ...;

        [your site configuration]

        location /restreamer1/ {
            proxy_http_version 1.1;
            proxy_pass http://192.168.0.11:8080/;
            proxy_redirect off;
        }

        location /restreamer2/ {
            proxy_http_version 1.1;
            proxy_pass http://192.168.0.12:8080/;
            proxy_redirect off;
        }

        location /restreamer3/ {
            proxy_http_version 1.1;
            proxy_pass http://192.168.0.13:8080/;
            proxy_redirect off;
        }

        ...
    }
}

Example 3: nginx is serving your website via HTTPS and you want access Restreamer at /restreamer/. Restreamer is running on the same server at β€œ127.0.0.1:8080”:

http {
    server {
        listen 443 ssl http2;
        server_name ...;

        [SSL configuration]

        [your site configuration]

        location /restreamer/ {
            proxy_http_version 1.1;
            proxy_pass http://127.0.0.1:8080/;
            proxy_redirect off;
        }
    }
}

Please note that you don't need to enable HTTPS in Restreamer, because nginx is already handling the SSL connection.

Example 4: nginx is serving your website and you want access Restreamer at /restreamer/. Restreamer is running in the local network at β€œ192.168.1.42”. The Restreamer HTTP server is listening on port 8080 and the RTMP and SRT servers are listening on ports 1935 and 6000 resp.:

http {
    server {
        listen 80;
        server_name ...;

        [your site configuration]

        location /restreamer/ {
            proxy_http_version 1.1;
            proxy_pass http://192.168.1.42:8080/;
            proxy_redirect off;
        }
    }
}

stream {
    server {
        listen 1935;
        proxy_pass 192.168.1.42:1935;
    }

    server {
        listen 6000 udp reuseport;
        proxy_pass 192.168.1.42:6000;
    }
}

See the Nginx documentation for more details.

Apache

Example 1: Apache is serving your website and you want access Restreamer at /restreamer/. Restreamer is running on the same server at β€œ127.0.0.1:8080”:

<VirtualHost *:80>
        ServerName ...

        [your site configuration]

        <Location "/restreamer/">
                ProxyPass http://localhost:8080/
        </Location>
</VirtualHost>

Example 2: Apache is serving your website and you want access multiple Restreamer at /restreamer1/, /restreamer2/, and /restreamer3/. All Restreamer are in a local network that is connected to your server:

<VirtualHost *:80>
        ServerName ...

        [your site configuration]

        <Location "/restreamer1/">
                ProxyPass http://192.168.0.11:8080/
        </Location>
        
        <Location "/restreamer2/">
                ProxyPass http://192.168.0.12:8080/
        </Location>
        
        <Location "/restreamer2/">
                ProxyPass http://192.168.0.13:8080/
        </Location>
</VirtualHost>

Example 3: Apache is serving your website via HTTPS and you want access Restreamer at /restreamer/. Restreamer is running on the same server at β€œ127.0.0.1:8080”:

<VirtualHost *:443>
   ServerName ...
   
   [your site configuration]
   
   SSLEngine on
   SSLProxyEngine On
   SSLCertificateFile /path/to/fullchain.pem
   SSLCertificateKeyFile /path/to/privkey.pem
   Protocols h2 http/1.1

   <Location "/restreamer">
      ProxyPass http://127.0.0.1:8080/
   </Location>
</VirtualHost>

Please note that you don't need to enable HTTPS in Restreamer, because Apache is already handling the SSL connection.

See the Apache documentation for more details.

Caddy

Example 1: Caddy is serving your website and you want access Restreamer at /restreamer/. Restreamer is running on the same server at β€œ127.0.0.1:8080”:

your.site.com {
	handle_path /restreamer/* {
		reverse_proxy 127.0.0.1:8080
	}
}

Example 2: Caddy is serving your website and you want access multiple Restreamer at /restreamer1/, /restreamer2/, and /restreamer3/. All Restreamer are in a local network that is connected to your server:

your.site.com {
	handle_path /restreamer1/* {
		reverse_proxy 192.168.1.11:8080
	}
	
	handle_path /restreamer1/* {
		reverse_proxy 192.168.1.12:8080
	}
	
	handle_path /restreamer1/* {
		reverse_proxy 192.168.1.13:8080
	}
}

Caddy will automatically serve your site with HTTPS enabled in case you configured your DNS correctly. Read more about Automatic HTTPS with Caddy.

Please note that you don't need to enable HTTPS in Restreamer, because Caddy is already handling the SSL connection.

See the Caddy documentation for more details.

Learn more

pageUser GuidespageManual

Last updated