Here's a setup using a reverse proxy so that you can use relative url (instead of messing with domain names in your webpages) and which also has the advantage of taking care of CORS issues you would have while making ajax calls to your backend.
If you are not familiar with reverse proxies, just know that all http requests should first hit the reverse proxy, and the reverse proxy will take care of forwarding those http requests to the correct http server following a set of rules.
In the docker world, a very convenient reverse proxy is Traefik.