How set subdomain to point to different IP address from main domain

I have 2 different servers (so 2 different IP addresses).

Currently, my domain (let’s call it example dot com) points to the first IP address.

I now want to point staging dot example dot com to the 2nd IP address.

I tried creating a second “A” record and called it “staging” and pasted in the 2nd IP address.

But browsing to shows “Error 522 Connection timed out”.

And if I try to ping, I see results from some 3rd IP address that I’m not familiar with.

So then when I try to browse to that 3rd IP address to see who it is, I get this error:

Error 1003
Direct IP access not allowed
You’ve requested an IP address that is part of the Cloudflare network. A valid Host header must be supplied to reach the desired website.

What am I doing wrong?

That’s a normal setup for many users here. If you’re proxying through Cloudflare (DNS set to :orange:), you’re going to see Cloudflare’s IP addresses for your (sub)domain when you ping it.

That 1003 error is because of the above: That’s a shared IP address at Cloudflare for many sites using Cloudflare.

I’ll post a link to some 522 tips, but if you want to test this subdomain to see if it works, go to the DNS section of the Cloudflare Dashboard and set it to :grey:.

1 Like

Thanks for your response.

I hadn’t thought of changing the orange cloud to gray (i.e. change from Proxied to “DNS only”).

After doing that and then running dig @ +trace +question A, I do see the correct IP mentioned in the results.

So maybe that means my Nginx config is faulty, even though I have already tested that a ton and can’t see how that would be the case.


Now for debugging purposes my Nginx config says:


And I’ve left the subdomain “A” record in CloudFlare DNS as “DNS only” (gray cloud).

Then in my CloudFlare DNS for (a different domain that I own), I temporarily pointed it to the new server’s IP.

And browsing to results in “This site can’t be reached took too long to respond. ERR_CONNECTION_TIMED_OUT” .

But browsing to works.

This leads me to believe that the Nginx config is fine.

Do you have any ideas @sdayman? I appreciate your help :slight_smile:

@sdayman Never mind.

I think the first problem was that my Page Rules were redirecting http to https, and I’d temporarily commented out the SSL parts of the Nginx config.

After uncommented the SSL parts, now browsing to results in:

400 Bad Request
No required SSL certificate was sent 

which is a totally separate issue. So I guess this ticket is finished.

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