Is it possible for CloudFlare to get content from 8080 and serve it on 80?

12,136

To the best of my knowledge, no. CloudFlare on the free plan can't do port translation. If you make a request on port 80, CloudFlare will send it to your origin on port 80. CloudFlare is essentially invisible. On the enterprise plan CloudFlare may be able to do this for you.

If your server is on port 8080 you should install a reverse proxy. This can be on the same server as the application server, or on a different server. On a different server, with appropriate firewall rules, you can make a DMZ, which increases security.

Nginx is very commonly used as a reverse proxy, either on the same server as your app server or a different server. Nginx can easily accept requests on port 80 then pass them on to an app server running on port 80. It's very lightweight, requiring very little CPU or RAM.

Nginx can also cache pages, based on rules you define, to accelerate serving static resources or anonymous pages. Serving a page from a cache takes much less work than generating the page again. Nginx reverse proxy guide here. I also have an Nginx/Wordpress guide that will give you some more examples on how to cache pages for anonymous users, but not logged in users.

Update based on comments

Apparently on Linux you can use iptables to redirect ports. So for example a server running on port 8080 can respond on port 80. This would have to be set up by a user who as root privileges, as non-privileged users can't listen to ports below 1024.

Share:
12,136

Related videos on Youtube

Theo
Author by

Theo

Greetings! :) I'm not great with servers and mostly do this as a hobby, but that doesn't stop me from trying to play around with them...

Updated on September 18, 2022

Comments

  • Theo
    Theo over 1 year

    Is it possible for CloudFlare to get content my server provides over port 8080 and serve it on port 80 to users?

    For instance, I have the following IP address 0.0.0.0 and domain example.ga (registered with CloudFlare). Can CloudFlare retrieve content from 0.0.0.0:8080 and display it on example.ga:80?

  • Aaron Hudon
    Aaron Hudon about 7 years
    On Linix you can also set up a Iptables redirect rule, so the port 80 also answers to requests to 8080, this is typically used when your java web server which has no root priveledge.