I have solved the problem with a linux server behind the firewall.
There’s a knock daemon installed. When I knock with a special sequence it will connect to the Mikrotik router via ssh
and change the to-address of the NAT rule via script for the port 443.
that’s exactly what I was asking about: how do you use port knocking on udp, if all ports are blocked except 80/tcp and 443/tcp?
if they are allowed, then you may use something like that:
/ip fi man add chain=prerouting in-interface=WAN dst-address-type=local protocol=tcp dst-port=12001 action=add-src-to-address-list address-list=to-server-1 address-list-timeout=00:00:05
/ip fi man add chain=prerouting in-interface=WAN dst-address-type=local protocol=tcp dst-port=12002 action=add-src-to-address-list address-list=to-server-2 address-list-timeout=00:00:05
/ip fi nat add chain=dstnat in-interface=WAN dst-address-type=local protocol=tcp dst-port=443 src-address-list=to-server-1 action=dst-nat to-addresses=server01_IP
/ip fi nat add chain=dstnat in-interface=WAN dst-address-type=local protocol=tcp dst-port=443 src-address-list=to-server-2 action=dst-nat to-addresses=server02_IP
now you just do ‘telnet IP 12001’ - and then you have 5 seconds to establish SSH connection to port 443 - and it will be redirected to server01. the same with server02 and ‘telnet IP 12002’