I am trying to access a rtmp stream of an internal IP camera, from the internet using a web browser. The config above is what I have tried, but no luck so far.
4. Error messages and/or full log output:
?
5. What I already tried:
I have tried the above config using HTTP, RTSP and RTMP streams
Have a look at your web browsers’ network tab in the dev tools.
You could also compare the network tab when you open http://192.168.0.2/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=123456 vs cam.site.me.
The http://192… works well in the web browser. Only through cam.site.me does not work.
PS cam.site.me is not the real domain I use, but it should not have an effect on my issue. I use other links in my caddyfile (eg cloud.site.me), and they all work ok.
I am not sure where to paste the log (output of journalctl -u caddy --no-pager | less +G) because it’s huge, but the part since the last caddy reload can be seen here.
I figured something out… @emilylange 's reply was of great help.
When I access the internal IP stream address through a browser (eg. “http://192.168.0.2…”), the stream worked fine.
When I tried to access the stream through the domain name (eg. “cam.site.me…”) the page was not loadig, BUT ONLY FROM MY INTERNAL NETWORK. If I use a VPN or access this domain from anywhere outside of my network, everything worked as expected.
Anyways, thank you @francislavoie and @emilylange for putting up with someone with my embarrassing level of IT skills.
Ah that makes sense. That’s typically because your router doesn’t support NAT hairpinning, i.e. it doesn’t know how to route connections to your WAN IP back into your local network. See Network address translation - Wikipedia
One way to solve that is to use a DNS server in your local network to make that domain resolve to your LAN IP instead for devices inside your network. Or use a different domain which you make resolve to your LAN IP, if you don’t absolutely need it to be the same domain (for cookies to be remembered by the browser, or whatever).