SBC + webcam proxying via DWC/DCS
-
I'm wondering if anyone considered or built a reverse-proxy for the classical webcam server via mjpg_streamer behind DSF or DCS?
My problem is that mjpg_streamer (and others using the same approach) run on a different port that than DWC. This mean accessing DWC via a VPN requires a different IP - which often breaks when not carefully configured (booksmarks, DWC settings, etc.)
For example, the SBC with DWC runs on
http://192.168.1.40
and the mjpg_stream running on the same SBC listens on port 8080, so needs to be configured viahttp://192.168.1.40:8080/stream.html
.If I now access via VPN, my SBC might have a different IP - making the webcam config invalid...
I saw the DSF API for custom HTTP endpoints, but it seems this API only supports static responses. For MJPG video streams to work, we would need a streaming response type. Something like this pseudo-code:
def respond_webcam_stream(): await http_endpoint_connection.read_request() await http_endpoint_connection.send_response(body="http://localhost:8080/?action=stream", response_type=pydsfapi.HttpResponseType.Proxy) cmd_connection = pydsfapi.CommandConnection() endpoint = cmd_connection.add_http_endpoint(basecommands.HttpEndpointType.GET, "webcam", "stream") endpoint.set_endpoint_handler(respond_webcam_proxy)
And then /opt/dsf/bin/DuetWebServer would handle the actual reverse-proxying of shuffling bytes from one socket (from localhost:8080) to the other socket (to the client).
Unless something like this is already possible, please consider this a feature request for a new "reverse-proxy" HtttpResponseType in the DSF-API.
Yes, I could build this myself with an Apache/nginx that reverse-proxies DWC + mjpg_streamer, but why introduce yet another layer when DWC/DCS is already 95% there?