First off, you need to understand that there is no automatic relationship between 'example.com' and 'www.example.com'.
'www.example.com' is just a hostname within the 'example.com' domain, and is no different from any other hostname such as 'mail.example.com', 'foo.example.com', etc.
Now, by convention/convenience most people map 'example.com' and 'www.example.com' to the same IP address so that (lazy?) users can type the former into a browser and get to the web site, but that's not an automatic thing.
In this case, since it works externally but not internally, it sounds like you're using two different DNS servers (one for public users and a different one for private/LAN users) - which is a good idea. It just means that the internal DNS doesn't have the same configuration that maps 'example.com' to the address of your web server.
As for the fix - make sure that 'example.com.' has an A record that points to your web server's address.
FWIW, it'll usually want to be a DNS CNAME (alias) and not an DNS A (machine) record that gets added.
DNS A records are expected to work the same for both forward and reverse DNS translations — DNS host name to IP address as the forward, and IP address to name as the reverse — and — given you're aliasing the host — that isn't and won't be the case. Hence... CNAME would be more typical. One DNS A record per host IP address, and however many CNAMEs you want to use.
Not for the domain record, it won't.
According to 'the rules', the domain record 'example.com.' may not be a CNAME record.
Other records (e.g. 'www.example.com.') may CNAME to the domain ('example.com.'), but not the other way around.
This issue is clouded by the fact that some DNS servers accept and allow it, while others don't.
For reference, check section 2.4 of RFC 1912 regarding CNAME records.