Set cookies in Nodejs Backend and Frontend that are running on different ports

  cookies, docker, express, node.js, proxy

I’m working with Express NodeJS and I’d like to have my backend and frontend separated, they should run on different machines.
Right now I’m working locally using my local private IP (NOT the localhost) so I can access to the website using all the devices that are connected to my Wifi but the final plan would be to have 2 docker containers, one for the backend and one for the frontend.

The problem is that I just implemented the authentication and from the backend when I send cookies to the frontend they are not set. I saw other discussions where people say that it is not possible to set cookies from domainA to domainB for security reasons.

As far as I understood this will NOT be a problem in production because there I will have something like DockerA reachable at for the frontend and DockerB reachable at for the backend so there should be no problem with the cookies because the main root domain will be the same (even if the IPs will be different).
Is my assumption correct? If not, could you explain why so I can fix the design as soon as possible?

The problem is: how can I simulate this environment locally? So that my development code can behave the same as in production?
How can I simulate the same domain locally on different ports with Express?
Not on the localhost but on the private IP address.

Note: I don not want to use proxies, I enabled CORS for making requests.

Source: Docker Questions