There is really cute drawing which explains RemoteForward
in openssh. But the remote forwarding is probably more complicated in your use case than you describe.
You would need to change at least /etc/hosts
to make it at least a bit transparent to your application:
127.0.0.1 api.com
Or change your application to connect to localhost directly instead of api.com.
And please note, that
Privileged ports can be forwarded only when logging in as root on the remote machine.
from man ssh_config(5)
. This means, that you can't bind port 443 without root privileges (or even other mechanisms like SELinux can block you from doing so). You need these privileges or rather you should choose different local port and it makes it even less transparent for your application.