WebRTC Livestream CORS error across network

I am trying to use the WebRTC Livestream extension across networks. I am doing this by port forwarding.
I am using http://<public_ip>:8211/streaming/webrtc-demo/?server=<public_ip>

The web interface loads but the stream is blank and the console a CORS error.

Access to fetch at 'http://x.x.x.x/' from origin 'http://x.x.x.x:8211' has been blocked by CORS policy

I tried to look into the WebRTC Backend Livestream code and handle the CORS policy myself but I can’t figure out how to add a middleware for it.

It works fine locally.

The docs: WebRTC Browser Client — Omniverse Create documentation (nvidia.com) don’t really say much besides explaining that it uses STUN servers. There is nothing in the extension.toml to configure for CORS.

Am I doing something wrong in how I’m hosting the server/client? I’m not really doing anything special besides port forwarding.

Hi @vlad.crehul. Let me check with the dev team.

Can we get an update on this? I am having the same issue.

Hi. Sorry for the delay. Here’s a suggestion that I got from the dev team:

Perhaps you can attempt configuring CORS Headers for streaming using the following configuration settings for your app:

exts."omni.services.transport.server.http".cors.enabled = true
exts."omni.services.transport.server.http".cors.allow_origins = ['*']
exts."omni.services.transport.server.http".cors.allow_credentials = false
exts."omni.services.transport.server.http".cors.allow_methods = ['*']
exts."omni.services.transport.server.http".cors.allow_headers = ['*']
exts."omni.services.transport.server.https".cors.enabled = true
exts."omni.services.transport.server.https".cors.allow_origins = ['*']
exts."omni.services.transport.server.https".cors.allow_credentials = false
exts."omni.services.transport.server.https".cors.allow_methods = ['*']
exts."omni.services.transport.server.https".cors.allow_headers = ['*']

Note that these settings would disable all CORS restrictions on your services, which may not be desirable for a production environment. If these happen to have a positive result for you, perhaps you may be inclined to configure these options with finer-grained CORS settings before deploying (perhaps with this reference for support: Cross-Origin Resource Sharing (CORS) - HTTP | MDN)

1 Like

I figured it out. So the extension where we need to configure it from is from the HTTP(S) SERVER: omni.services.transport.server.http it seems that extensions.toml are configured between Omniverse Code and Isaac Sim.

So pretty much the settings you are mentioning but I would indeed avoid using wildcards.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.