How to port proxy an API


We built a NodeJS API that serves a HTML template and exposes a few user management handlers.

The app is served from an Amazon EC2 instance with a Security Group that opens port 3000 to the internet.

Additional Notes

We don't select Enable Cache because we don't want to cache API responses. We Use HTTP because our domain is SSL-enabled but our API is not.

To try out the API, check out the instructions on the API's home page.

Step 1
Point a subdomain at your server

In your Cloudflare Dashboard, click the DNS tab and add a CNAME record pointing your desired subdomain at your server.

portzilla dns configuration
Step 2
Expose your service to outside traffic

Ensure your service can communicate with the internet. Our service is running on an EC2 instance, so we add our Target Port to the Port Range field in our EC2 Security Policy.

portzilla aws configuration
Step 3
Configure and install Portzilla

Once the service is open to the internet, we configured and installed Portzilla with the following options.

Route Configuration

Route Name
My API Route
Route URL
Route Target
Proxies to a port on my domain
Target Port
Step 4
Connect to your API

Once installed, navigate to your service's Route URL. Our browser is rendering the root path of our API.