Assuming two different hosts, is it possible to point a.site1.example so that it serves up b.site2.example?

When someone visits a.site1.example I want them to see what is hosted at b.site2.example

What is the DNS required on each site to do this?

  • Whats your goal ? and do you own both site ? Imagine someone that do that on a banking site..
    – yagmoth555
    Mar 28 '18 at 23:14
  • Depends on what you mean with "reflects b.site2.com". Do you want to serve a website? Do you want the user to be aware that he's redirected? A little more info would be nice.
    – Broco
    Mar 29 '18 at 8:11
  • @Broco, re-worded. I want it to serve up the site.
    – kylex
    Mar 29 '18 at 18:04
  • @yagmoth555 I own the site that will be served up (b.site2.com), and want to allow other others the ability to host it on their own subdomain.
    – kylex
    Mar 29 '18 at 18:06
  • Just because I don't think it's clear, a.site1.com can never just "serve up" b.site2.com solely through DNS -- sites are served over HTTP. At best, you will be able to provide a method for a.site1.com to point at b.site2.com, and allow b.site2.com to respond for it. All resources required for the site to exist will still rely on b.site2.com. If you actually want a.site1.com to be its own server serving up b.site2.com that would be through an HTTP daemon like Apache providing a reverse proxy, which a.site1.com would point to
    – brent
    Mar 29 '18 at 18:09

This can be done by using a CNAME for a.site1.example and point it to b.site2.example

You will have to accept requests for both b.site2.example and a.site1.example at b.site2.example because there will not be any HTTP redirects.

The client will do somethink like this.

  1. Whats the ip for a.site1.example
  2. The client will get the answer b.site2.example
  3. The client will ask for the IP of b.site2.example
  4. The client will connect to the IP of b.site2.example and send the http host header with the hostname a.site1.example
  • You may run into a problem if there is an existing A-Record for a.site1.com
    – JohnA
    Mar 28 '18 at 23:00

Configure a webserver answering requests for https://a.site1.example which will return HTTP redirects for any URL and pointing to https://b.site2.example.

DNS wise this means that both names must resolve (through A/AAAA/CNAME records) to the correct servers, the same one or separate ones (your question lacks details)

If you do not want people to see the new URL then the first webserver needs to be configured as an HTTP proxy. This comes with various drawbacks, including performance loss to start with, but again your question lacks specific details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.