JupyterLab local docker image in iFrame gives websocket authentication errors

Hello, I am hosting a local instance of jupyter/minimal-notebook in a local Docker instance. I am then embedding it in an iFrame served by a local Flask app. If I open the Lab url directly in a tab, everything works fine. When I open it in the iFrame, I am able to load the main UI, but when I try to open a file I am unable to connect to the kernel. I get errors in browser console as well as the jupyter container. This happens with Chrome, Firefox, and Safari (all up to date).
Anyone have any ideas?

Browser Console:

jlab_core.081dc2b13065c79d8463.js?v=081dc2b13065c79d8463:2
WebSocket connection to 'ws://0a3682688800.nb.docker/api/kernels/543049ae-56c4-4556-95c6-250ab41d6fc2/channels?session_id=2b35e0c8-7eb7-43ec-b9ec-6400e9e61f58' failed:
_createSocket @ jlab_core.081dc2b13065c79d8463.js?v=081dc2b13065c79d8463:2

Docker Container:

[D 2022-08-04 19:48:41.202 ServerApp] Accepting token-authenticated connection from 172.17.0.2
[D 2022-08-04 19:48:41.203 ServerApp] 200 GET /api/kernels/d9f0daa1-bf3c-4f41-8d9f-c5c617778844?1659642521196 (172.17.0.2) 1.68ms
[D 2022-08-04 19:48:41.210 ServerApp] Initializing websocket connection /api/kernels/d9f0daa1-bf3c-4f41-8d9f-c5c617778844/channels
[W 2022-08-04 19:48:41.212 ServerApp] Couldn't authenticate WebSocket connection

The only custom configuration I have is this. I don’t think the second domain is required, but I added it while troubleshooting.

c.NotebookApp.tornado_settings = {'headers': {'Content-Security-Policy': 'frame-ancestors myiframedomain.docker thejupytercontainerdomain.docker \'self\' ;'}}