Redirect IP:port to domain:port

but I also want to force redirect traffic from ip: port to domain: port. Do you have any suggest ?

Directly on the Port 8006 and without manually changing the code: no.

In general I'd use a reverse proxy like traefik to prefilter stuff, but you can only use that on a new port. I often combine that with other webservers, so that I can have https://proxmox.<myserver>.<mydomain>/ (without any different ports) and have additional BasicAuth authentication. With this approach I only have two ports to the outside world 80 and 443 and the redirection is done directly via traefik, as is the SSL-stuff and all behind is just "reverse proxied".
 
Directly on the Port 8006 and without manually changing the code: no.

In general I'd use a reverse proxy like traefik to prefilter stuff, but you can only use that on a new port. I often combine that with other webservers, so that I can have https://proxmox.<myserver>.<mydomain>/ (without any different ports) and have additional BasicAuth authentication. With this approach I only have two ports to the outside world 80 and 443 and the redirection is done directly via traefik, as is the SSL-stuff and all behind is just "reverse proxied".

I never used it before, i'm learning about it. If possible, could you please give me some instruction detail document for config that redirect ?