Point domain to ip and port

Hello!

I’ve had my domain troff.xyz for a couple of months now, hosting it on GitHub pages without any issues. Until today.

Today I decided it was time for something new. I decided to hook my new project up to my domain. I’m running a webserver on my computer (to clarify: I am hosting my own page), and I’ve configured my router to locally port-forward all incoming connections from port 8288 to the port that I’m using to run my webserver on my computer.

Connecting directly via my public/external ip, appending :8288 to it (1.2.3.4:8288) works completely fine. What I want is for my domain (troff.xyz) to point to my IP. I’ve come to realise that it is not possible to use an A record to forward to a certain port on an IP address, but I had hoped that by using a SRV record, putting it on root with port 8288 and target 1.2.3.4 (my external ip), that would work. But it does not.

Trying to access my site via troff.xyz gives me no information except “522 timed out”, and my server is not receiving any requests. If you have any ideas, please let me know.

Is it even possible, what I’m trying to do? Do I need to choose another port? Is my current port not compatible? If so, shouldn’t I get another error? Is my best bet just exposing my webserver on port 80, but I’d rather not to avoid webscrapers and other annoying stuff since it is my personal/home ip-address.

Thanks in advance

Edit May 21, 2019: See the following Cloudflare app! It should allow you to point your domain (on port 80/443) to a different port on your server, and for free! CLICK HERE.


Old response:

See “which ports will Cloudflare work with”: https://support.cloudflare.com/hc/en-us/articles/200169156-Which-ports-will-Cloudflare-work-with-

A SRV record will end up revealing the real IP address, and CF doesn’t support proxying any services within a SRV record anyhow. Best to remove that record and use one of the above ports.

3 Likes

Awesome. Thanks so much for the reply!
Alright, so if I forward one of the ports mentioned in the article above (2096 for example) to my webserver internally, how and where do I specify this port, if at all? Or is an A record all it takes?

Thank you.

As long as your web server and router listen on that port, and there is an A record set, there’s no need to specify a port number.

2 Likes

Alright, much appreciated. Thanks.
Still having issues though. I have configured my server to run on port 80 on my public ip, so it can be accessed simply by typing my ip in the address bar. Two A records are in place, one with @ as name and one with www as name. They both point to my public ip.

Yet, when navigating to my domain name (troff.xyz) I still have a really delay where it just waits for a response (“loading”) before finally giving me a 522 error from Cloudflare.

Are there any other vital records I must have for it to work?

If you want SSL, you should set SSL to “flexible” in the settings tab. This will cause CF to connect to your server over HTTP (port 80), but still connect over HTTPS to visitors. Otherwise, for “Full” ssl, you’ll need to also port forward port 443 and set up your web server for that port.

If you don’t want SSL, turn off always use HTTPS.

2 Likes

Works like a charm now. I wish there was something more I could do to thank you. You’ve saved me countless hours of work. Maybe I’m just really bad at googling, but I haven’t been able to find information about this stuff.

You, sir, are a hero.

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.