Question

I'm currently hosting content for a client. I need my to point a client's subdomain "promo.client1.com" to a folder in my site: "mysite.com/client1" so visitors see my client's domain while accessing the content (I can't use a redirect).

I'm wondering what should I ask my client to do.

I have been assured this can be done through an A record pointing to my IP. Is this right? How can this be done?

Was it helpful?

Solution

Considering that you cannot operate a redirect, you have basically two choices: proxy or DNS.

Using a proxy, your business associate can set up a proxy that will intermediate browser's requests to your server. The concept is called reverse proxy and there is plenty of documentation around on how to implement one.

The other option is to setup a DNS entry that points an entry of his domain to a particular address on your servers.

You can either have an exclusive IP address assigned to your associate's entry, and then have him add a A record to your dedicated exclusive IP address in his DNS tables, like this bind standard config format:

your-server.businessassociate.com IN A 1.1.1.1

Supose that 1.1.1.1 is the exclusive address you assigned to the server that will be replying to requests to your business associate's domain entry. You will most likely have a virtual server answering with that configuration.

The other option is to ask your business associate to create a CNAME entry in his DNS tables referencing your server by name. You should never have another A entry for a server that already has one, so CNAME is like an "alias" and will reflect changes in your original server name's IP address, once you change your own DNS entry. Like this:

your-server.businessassociate.com IN CNAME your-server.your-domain.com

And then you have to setup a virtual server on the webserver running on your-server.your-domain.com machine to handle requests directed to your-server.businessassociate.com.

What you cannot do via DNS is exactly what you have in your question: promo.cluent1.com can never translate to mysite.com/client1 because DNS cannot deal with the specifics of HTTP, like what is after that slash. You can achieve similar result by setting up a virtual host on your http server that rewrites internally your-server.businessassociate.com to mysite.com/client1, but you cannot escape from setting up a virtual host or alike.

OTHER TIPS

This answer doesn't conform to the latest edit of the question. I chose to keep it as a reference of what could be done if a redirect was acceptable

First things first, lets not use the term "client" for your business associate, because it will make a mess of this answer. Client in this answer is the user, the browser that requests content.

Given that you need to call a different server (the user asked for the business associate's server, but he has to ask for your server instead), either your business associate will have to issue a REDIRECT (permanent or temporary) or he will have to proxy your content through his server and from there to the user. It is not possible to have a rewrite action alone solving such an issue.

As for a REDIRECT, it can be done in his server configuration, or using a HTML with a REDIRECT in it.

Check this question out on how to issue a redirect from a HTML file or using server configuration. Be sure to check out the comments about the pros/cons of each approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top