I read it again and I got a little mislead by the resolving script before. What I suggested would replace only this part. But in fact, you don’t need any DNS resolving at all (well, possibly, see below).
You have two options:
a) Stick with hairpin NAT. The example assumes that your LAN network is 192.168.88.0/24, router has 192.168.88.1, internal server has 192.168.88.100 and your want to forward tcp port 80. Change it to your numbers. First add dstnat rule:
/ip firewall nat
add action=dst-nat chain=dstnat dst-address-type=local dst-address=!192.168.88.1 dst-port=80 protocol=tcp to-addresses=192.168.88.100
It will match connections to port 80 and any address owned by router, except its internal one (so you can still access WebFig on http://192.168.88.1 if you use it). Then add srcnat rule for hairpin NAT:
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 out-interface=<LAN> src-address=192.168.88.0/24
It’s universal one and will work with all ports you forward. And finally allow forwarded ports through router’s firewall:
/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat
b) Use DNS as w177f suggests:
/ip dns static
add address=192.168.88.100 name=sam9s.synology.me
Your devices in LAN need to use router as their DNS resolver, and thanks to this, when going to http://sam9s.synology.me, they will connect directly to internal address.
Each way has advantages and disadvantages:
Using static DNS seems simpler at first. It’s also better for performance, because packets don’t need to go to router and back, they go to server directly. But there are some limitations, e.g. connect a device with statically configured DNS resolver to something else than your router and it won’t work. If you point more hostnames to you, static record will be required for each. And you have to keep up with changes (if you add or remove hostnames). But it’s probably safe to assume that it shouldn’t be a problem in your case. It also doesn’t allow connections to numeric address, because you can’t redirect it with DNS.
Hairpin NAT is “set it & forget it”, it will automatically work with any hostname pointed to your current WAN address. But it’s less effective, as mentioned previously. But it’s a problem only when you have a lot of traffic.