Welcome! Log In Create A New Profile

Advanced

proxying webrtc-streamer

Posted by rossbcan 
proxying webrtc-streamer
January 02, 2020 08:52AM
Hi;

OpenWrt x86_64. I have a webrtc-streamer instance serving RTSP IP cameras at 192.168.1.8:8000 which is working on my local LAN, and, if I port forward, also on wan at mysite:8000. Now, I want to use name based as opposed to port redirection.

[code]
upstream video {
server 192.168.1.8:8000;
}

server {
listen 80;
listen [::]:80;
server_name rossco.org *.rossco.org;
location /.well-known/acme-challenge/ {
default_type "text/plain";
allow all;
alias /var/letsencrypt/;
}
location /cameras/ {
rewrite ^/cameras/.* $1 last;
proxy_pass http://video;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443;
listen [::]:443;
server_name rossco.org *.rossco.org;
...
}
[/code]

Intent is that www.rossco.org/cameras is re-written (strip cameras from url) and redirects to 192.168.1.8:8000.

What I am seeing is error 404, indicating location "cameras" not being recognized. No re-write.

Anyone want to throw me a bone?

Thanks;
Bill
Solved: proxying webrtc-streamer
January 03, 2020 08:05AM
update /solution:

changing: rewrite ^/cameras/.* $1 last;
to: rewrite ^/cameras/.* $1 break;
(from re-write, look for match, leading to 404 to re-write, continue block processing)
...got me to 192.168.1.8:8000 base page

...then had to deal with static files.

Full solution - working
[code]
upstream video {
server 192.168.1.8:8000;
}

server {
listen 80;
listen [::]:80;
server_name rossco.org *.rossco.org;
location /.well-known/acme-challenge/ {
default_type "text/plain";
allow all;
alias /var/letsencrypt/;
}
location /nav.css {
proxy_pass http://video;
}
location /api/ {
proxy_pass http://video;
}
location /cameras/ {
rewrite /cameras/(.*) /$1 break;
proxy_pass http://video;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443;
listen [::]:443;
server_name rossco.org *.rossco.org;
...
}
[/code]

demo active at: www.rossco.org/cameras/



Edited 1 time(s). Last edit at 01/03/2020 08:08AM by rossbcan.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready