That’s not a supported setup – Discourse needs to know the hostname it is running at. I’m pretty sure that there will be more breakage than just images if the hostname is wrong.
I you need outside access to Discourse, you’ll need to use a technique that allows you to access Discourse at the original domain name configured in app.yml, e.g. a VPN tunnel.