Docker container communication port usage

I’m having some trouble understanding how docker containers communicate. I’m trying to change my setup from a single docker container published on port 80 to a nginx reverse proxy setup. First, to test this I have published nginx on port 99 so my webapp can still be used:

Webapp -p 80:8080
nginx -p 99:80

I’ve set up the reverse proxy to point to these host:port (webapp is assigned by a local dns and only used internally):
http://webapp:80/ (does not work)
http://webapp:8080/ (works)

It seems that when the containers communicate between each other they do not use the mapped port but directly on the exposed port. Is this supposed to work this way? and if so, can someone explain why?

I found some info on the default docker bridge linking containers together however no mention of which ports are used. I do think that the answer lies there somewhere.