Publicip:port(3001) to https://api.website.com/

How do I redirect the subdomain “api” to a specific port like this:

https://api.website.com —> 1.1.1.1:3001 (publicip:port)

Some said that I must configure a reverse proxy but tbh I have no idea how to do it in Ubuntu 16.04 (or on any OS).
Is there any way to do it on Cloudflare?

Thanks.

what are workers?

No sure if this helps with your question.

You can achieve via Cloudflare Tunnel :
Cloudflare Tunnel exposes applications running on your local web server, on any network with an Internet connection, without adding DNS records or configuring a firewall or router. It just works.

In Cloudflare workers you are not allowed to fetch ip addresses.

If that remote server had a FQDN Workers can be used to request a non standard port.