I have cPanel & WHM v130.0.14 STANDARD running in an EC2 instance. Trying to setup a reverse proxy with Apache2 by setting a CNAME some.example.com (not the real one) to forward the request to api.demo.com — the catch is that I need to use some.example.com for input and output; that is, I need to be able to use some.example.com for receiving the request on my local server (input) and for sending it out, in order to fetch the right data on api.demo.com (output) — the reason for this is that on api.demo.com's end there's also a reverse proxy setup, but that's besides the point.
For this to work I would need to either set a static IP for some.example.com into /etc/hosts or, what I'm actually trying to achieve, set a CNAME in named (PDNS handled) to make some.example.com translate to whatever address api.demo.com resolves to.
Tried numerous solutions between setting a local zone for demo.com or creating forwarders, but I can't get anything to work; that is, it just resolves to the default record's address published by Cloudflare. As far as I've seen this should work, so for now I just reverted to the simple CNAME approach:
- /etc/resolv.conf
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 8.8.8.8
- /etc/named.conf
view "internal" {
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "192-168-0-10.cprapid.com" {
type master;
file "/var/named/192-168-0-10.cprapid.com.db";
};
zone "example.com" {
type master;
file "/var/named/example.com.db";
};
};
view "external" {
recursion no;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "192-168-0-10.cprapid.com" {
type master;
file "/var/named/192-168-0-10.cprapid.com.db";
};
zone "example.com" {
type master;
file "/var/named/example.com.db";
- /var/named/example.com.db
; cPanel first:124.0.21 (update_time):1760587729 Cpanel::ZoneFile::VERSION:1.3 hostname:192-168-0-10.cprapid.com latest:130.0.14
; Zone file for example.com
$TTL 14400
example.com. 86400 IN SOA ns1.192-168-0-10.cprapid.com. root.192-168-0-10.cprapid.com. 2025101605 3600 1800 1209600 86400
example.com. 86400 IN NS ns1.192-168-0-10.cprapid.com.
example.com. 86400 IN NS ns2.192-168-0-10.cprapid.com.
ns1 14400 IN A 192.168.0.254
ns2 14400 IN A 192.168.0.254
example.com. 14400 IN A 192.168.0.10
some 14400 IN CNAME api.demo.com.
Am I missing something?
(reposting from ServerFault)
api.demo.com's end there's also a reverse proxy setup...", but what I meant by it is atapi.demo.com's side this reverse proxy is pointing to a specificDocumentRootinside the server (within aVirtualHostblock) — bothsome.example.comandapi.demo.comserve HTTP requests using Apache 2.4ns1andns2there at 192.168.0.254) do not have thedemo.comzone configured, but when performing either adigor anslookupcommand I can seeapi.demo.combeing resolved correctly, yes. Have the feeling that I'm probably overlooking something very simple here, already stuck for days on this and just can't figure out what is wrong — also I apologize about the mock data, but I'm not sure I can safely divulge these addresses publicly as it's not within my jurisdiction to decide