I have a simple React Front-end that uses a proxy Node.js server to fetch data over http and ws. This runs completely fine on my local host.
When I run this within a docker container, the http calls still work, but the ws connection cannot be established.
If I expose my proxy server port with:
ports:
- 2999:2999
Also the ws connection starts to work. I do not want to expose the proxy server though. I thought about running this entire setup in another docker container, but that would be the last option for me.
I thought setting:
ports:
- "2999"
Would just make the internal port of the docker image available and solve my problem, but it does not.
How do I expose the port of the proxy to the react app, but not the outside network? (both react app and proxy are in the same docker image)