I have a server with Hetzner, and a few domains with Google Domains. I have an Apache server running on port 80, and a Node server running on port 8080.
If my server's IP is 192.0.2.4 and my domain example.com, I want to setup Google Domains so that:
- http://example.com opens http://192.0.2.4 (but still displays http://example.com in the browser)
- http://www.example.com opens http://192.0.2.4 (but still displays http://www.example.com in the browser)
- http://a.example.com opens http://192.0.2.4:8080 (but still displays http://a.example.com in the browser)
So far I added these rules in Google Domain:
@ A 1h 192.0.2.4
www CNAME 1h example.com
a CNAME 1h ghs.googlehosted.com (added as a subdomain redirection from a.example.com to 192.0.2.4:8080)
And I have this behaviour:
- http://example.com leads to a 404 (from Google, not from my Apache server)
- http://www.example.com works as expected
- http://a.example.com redirects to http://192.0.2.4:8080 but http://192.0.2.4:8080 is displayed in the browser instead of http://a.example.com
What do I need to change to get it working? Do I need to do something on Hetzner side?