Using CloudFlare with two different sites on the same IPV4 address

Hello, I am currently facing an issue on CloudFlare where I am trying to have my two sites up on the domain at the same time on two different ports. Currently, I host my main site using an A record pointing to the IPV4 address of the web server [mydomain.com] (port 80). However, I also have an additional administration panel for my staff that I want to run from the same IPV4 address but from a different subdomain [control.mydomain.com] (port 8080) but, I cannot add this to an A record, CNAME or SRV without getting some sort of issue. Is there a way where I can make this work?

Thank you.

Generally you don’t need different ports. That is what virtual hosting (in particular the Host header) was introduced for. So simply switch to name based configurations.

That being said, Cloudflare does not really play any part here. As long as your domains are reachable without Cloudflare you’ll be fine and they’ll be reachable with Cloudflare do.

If you were thinking about something like port rewriting, this is something Cloudflare does not do. You could look into the Portzilla application, but that will be paid. Again, simply use virtual hosting.

1 Like

The IP address can be reached without cloudflare, however, I cannot reach the site when I add the DNS record to my site. They are not on the same “site” per say they are on different web servers sharing the same public IP.

Layout:
209.x.x.x:80 = domain.com (public website used for customers/users)
209.x.x.x:8080 = control.domain.com (different site for our administrators to control our servers and mange FTP)

When connecting directly to the IPV4 address (209.x.x.x), both sites can be reached using either port.
When I add the second record to an additional DNS record, it does not take me anywhere.

What kind of record will I have to use to make this work? or am I missing something?

Not the IP address, the two domains/hostnames.

Essentially, make sure your domains/hostnames work fine without Cloudflare (particularly on HTTPS, though you will need ports other than 80 for that) and only once that works add Cloudflare.

1 Like

What you could do on Cloudflare’s side is set up a page rule to perform a redirect, but that would be still rather a hack than a proper setup.

Place both hostnames on port 443, make sure you have a valid certificate on your server, set your encryption mode to “Full strict”, and you should be good to go.

1 Like

Ok perfect, Thanks for the help!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.