2

I have an issue where I can't use ports 80 and 443 for my website/services because these are already taken on the router. I don't have control over, can't change it or put a reverse proxy in there so I am forced to use different ports. I found that cloudflare works with other ports, but I have no idea how to use those.

I tried using cloudflared tunnel and it works nicely, however I am aware that the TOS does not allow using tunnels for video streaming like Plex/kodi... and that would be one of the things I want to do.

Lets say I decide to use ports 2052 (http) and 2053 (https) instead of 80 and 443. All the traffic would need to use these ports on the router (aka my public IP) to reach the server where NGINX proxy manager would handle the rest to split up subdomains to services. I am asking for help with a step by step (beginner to cloudflare) explanation of how I could set it up and use my website. I know this will probably make the url uggly (subdomain.mydomain.com:port) but it needs to most importantly work.

Based on the first answer I guess it needs to be connected something like this illustration Based on the first answer I guess it needs to be connected something like this illustration

Gerge
  • 23
  • 3

1 Answers1

2

Ok, let's go one step at a time.

Cloudflare will resolve your domain to their IP addresses based on the location of the request. Those IP addresses will receive the traffic and proxy it to your IP address.

They will only proxy traffic to the ports listed on the link you provided. That means that the request needs to be made to the specific port you are working with.

There is not much to do on the terms of the ports on the Cloudflare site, they will not translate from one port to another. So if your request is sent to port 2052 from the client side, it will be proxied to port 2052 on the server side.

So make sure to add the correct port and protocol when making the request. Eg. https://example.com:2053

Marco Zink
  • 126
  • 7
  • Thanks, so far I at least got somewhere. I created a subdomain direct.mydomain.com that goes to the IP and not the tunnel. I set it up and I can get an HTTP connection on direct.mydomain.com:2052, however as soon as I add an SSL cerificate on NGINX proxy it breaks the whole thing. (I am using a cloudflare cert because letsencript does not work without 80/443) How do I get HTTPS to work? If I open 2053 will it use that and work? – Gerge Aug 18 '22 at 09:23
  • What do you mean by everything breaks? Are you sure there is nothing in your NGINX trying to redirect traffic to the standard HTTPS port? – Marco Zink Aug 18 '22 at 16:53
  • I had some bugs with the 2053 port, but it works now with SSL encription. I still need to figure out how to reditrect all http traffic to https, but that is a minute detail. I will mark the answer correct now. – Gerge Aug 18 '22 at 18:28