firewall-cmd not allowing loopback redirect

Solution 1:

firewalld installs a rule in the PREROUTING chain of the nat table. This table is consulted only for foreign traffic.

Locally generated traffic traverses the OUTPUT chain of the nat table, so you need to install a rule with:

firewall-cmd --direct --add-rule ipv4 nat OUTPUT 0 -s 127.0.0.1\
-p tcp --dport 400 -j REDIRECT --to-port 500