2

I have 2 domains and 2 hosting packages.

What I want: status.domainA.example to domainB.example/status. I want that status.domainA.example is in the address bar.

What I tried: I've set a CNAME record: status.domainA.example to domainB.example. domainB.example/status appeared. It was in the address bar. Further, before you can open it, you need to allow wrong-configured SSL.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
Chris van Chip
  • 504
  • 4
  • 20

1 Answers1

2

To achieve this you need to do the following -

  1. On the host where domainB.example is hosted, add a virtual host for status.domainA.example and point /status to the appropriate files.
  2. Add CNAME entry of status.domainA.example pointing to domainB.example

Alternate Way - Use a reverse proxy server or if using cloudflare of AWS use javascript workers (http://cloudflareworkers.com or AWS lambda)

  1. Point status.domainA.example to a worker.
  2. Add code in the worker to fetch the response from domainB.example/status and send the response.

If using as reverse proxy -

  1. Setup a reverse proxy server eg. nginx or any other.
  2. point status.domainA.example to the reverse proxy server.
  3. Add config to set domainB.example as backend of reverse proxy server.

You can refer to internet for details about how to setup reverse proxy server. - https://www.techandme.se/set-up-nginx-reverse-proxy/

If you have access to only file hosted on status.domainA.example than you can simply make a curl call to domainB.example/status and print the output.

Decide your approach

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
mdeora
  • 4,152
  • 2
  • 19
  • 29
  • I'm on a shared host with SSH access. I can't add virtual hosts. Further, I can't write code on the host of domainA.com. When the hosting from that one is down, it has to be possible to head to the status page. – Chris van Chip Dec 18 '18 at 12:46
  • You can do the alternate approach of reverse proxy. Add code for fetching domainB.com/status and respond on status.domainA.com. – mdeora Dec 18 '18 at 12:47
  • I've no access to resources like nginx. I can only use composer and have access to files. That's all what I can. – Chris van Chip Dec 18 '18 at 12:57
  • updated answer - If you have access to only file hosted on `status.domainA.com` than you can simply make a curl call to `domainB.com/status` and print the output. – mdeora Dec 18 '18 at 12:59
  • I've seen that I've access to cURL. But, now the next step: How to do that? I'm not experienced with cURL. – Chris van Chip Dec 18 '18 at 13:02
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/185442/discussion-between-chris-van-chip-and-mdeora). – Chris van Chip Dec 18 '18 at 18:34