Where to find my site's IP Address for setting up sub-domain

When configuring a sub-domain where do I get the IP Address for my website? I am using Cloudflare Pages so the top level domain is aliased to the *.pages.dev instance. I just don't know where to find this so that I can properly route the traffic. Been scanning through the docs but not finding anything here either. Anyone know where that can be found?
23 Replies
Hello, I’m Allie!
Adding a custom domain for your Pages Project requires a CNAME record, not an A/AAAA record. Firstly, is your custom domain on Cloudflare?
rockchalkwushock
rockchalkwushockOP2y ago
@HardAtWork Yep bought my domain through Cloudflare so it's in-house. The CNAME is setup to be the custom domain aliased to the *pages.dev and then what I am trying to do is setup a sub-domain for blog.my-site.com I have the Page Rule working for the redirect when /blog/* is encountered I just don't know where to get this IP address that the documentation keeps referencing
Hello, I’m Allie!
Which documentation is that? Can you link me to it?
rockchalkwushock
rockchalkwushockOP2y ago
yep one second
rockchalkwushock
rockchalkwushockOP2y ago
Create subdomain · Cloudflare DNS docs
Most subdomains serve a specific purpose within the overall context of your website. For example, blog.example.com might be your blog, …
Hello, I’m Allie!
Ok, and just to make sure, do you want the blog to be visible on blog.my-site.com
rockchalkwushock
rockchalkwushockOP2y ago
yep the index as well as all the routes pertaining to it never worked with sub-domains before so learning curve is pretty high and I'm not networking guru either
Hello, I’m Allie!
Go to https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/domains, and Set up a custom domain. For the actual domain, put in blog.my-site.com, and then it should start doing the work for you.
rockchalkwushock
rockchalkwushockOP2y ago
Okay got that setup so that now the DNS for the custom domain is the my-site.com --> my-site.pages.dev and the Pages has two custom domains my-site.com --> my-site.pages.dev blog.my-site.com --> my-site.pages.dev The Page Rule that I have is my-site.com/blog* --> blog.my-site.com Currently I'm getting back Error 1016 "Origin DNS Error" when I try to visit the blog.my-site.com Does the DNS for the custom domain still need an A record that points the sub-domain back at the my-site.pages.dev?
Hello, I’m Allie!
Is the Page Rule supposed to redirect people to the blog? Because right now, the root and the subdomain are serving the same content
rockchalkwushock
rockchalkwushockOP2y ago
Yes, from my understanding DNS doesn't know anything about the route in a URL so if someone visits my-site.com and clicks to go to the blog the app is going to go to /blog but DNS is just going to go to my-site.com/blog not the sub-domain so I added the Page Rule to redirect. ahhh okay I think I understand I didn't really say what I am trying to achieve well. my-site.com my-site.com/about my-site.com/abc All live at my-site.com But I want to scope all the blog to blog.my-site.com so all the routes including the index for /blog should live at that sub-domain sorry I didn't convey that well
Hello, I’m Allie!
You can do that. The issue is, right now anyway, blog.my-site.com is serving the exact same content as my-site.com, which I assume you don't want?
rockchalkwushock
rockchalkwushockOP2y ago
yep initially with my little understanding of this I was trying to point blog.my-site.com at my-site.pages.dev/blog but clearly that doesn't work it's all the same AstroJS app
Hello, I’m Allie!
The easiest way to get that to work the way I think you want it to is to break the blog off into its own Astro App
rockchalkwushock
rockchalkwushockOP2y ago
okay, so if I did that how do I get Cloudflare to recognize that it's two different application? Is it possible to do this as one application?
Hello, I’m Allie!
Not really easily. The easiest thing would be to have all off the content on a single site: my-site.com, my-site.com/about, my-site.com/abc, & my-site.com/blog. Trying to split blog off into its own domain, without it actually being a separate app, is quite difficult(and I'm not actually sure if you are able to do that without Workers).
rockchalkwushock
rockchalkwushockOP2y ago
okay I think I understand. It's been difficult to map out in my head how the DNS side of this works and that's probably the issue. So when it comes to using Cloudflare Pages I normally just connect to project via GitHub and setup the build to execute on push to production. Would this be separated into 2 separate Pages apps and then setup the custom domains as mentioned above?
Hello, I’m Allie!
No. If you want the blog to be on its own domain, you would need a separate Github Repo for the blog project, create a separate Pages project for it, and then connect the custom domain. I wouldn't recommend keeping both in the same repo.
rockchalkwushock
rockchalkwushockOP2y ago
okay makes sense now, thanks for all your help understanding this better. I really appreciated it. Do you have any recommendations on reading for better understanding DNS/sub-domains/etc. I am realizing this is a pretty big question mark for me when it comes to understanding what's happening behind the scenes.
Hello, I’m Allie!
Cloudflare
What is DNS? | How DNS works | Cloudflare
DNS, or the domain name system, is the phonebook of the Internet, connecting web browsers with websites. Learn more about how DNS works and what DNS servers do.
rockchalkwushock
rockchalkwushockOP2y ago
not necessarily Cloudflare but in general. I will read that as well
Hello, I’m Allie!
This is a more general learning guide. It may tell you about how CF products can help you with certain things, but it should also give you a grounding in how DNS itself works, or at least how you use it.
rockchalkwushock
rockchalkwushockOP2y ago
thanks so much I really appreciate all the help!
Want results from more Discord servers?
Add your server