El Dude
El Dude

Reputation: 5618

Proxy mechanism - forward subdomain to external server

How can I redirect one subdomain to an external server without using a proxy ? I use the mod_proxy - ProxyPass setting that works.

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName sub.domain.org
    ProxyPass / http://otherDomain.org
    ProxyPassReverse / http://otherDomain.org
</VirtualHost>

My current concern is that all traffic goes through domain.org. This is a virtual machine while and otherDomain is a real physical machine. I use OtherDomain because the webservice is data heavy. Would proxying the full traffic through domain.org slow down everything? How can I just forward to otherDomain.org ? Edit: Please note that domain.org is registered at a provider but otherDomain.org is just a machine with an IP address, registered nowhere.

Upvotes: 0

Views: 254

Answers (1)

ASCIInaut
ASCIInaut

Reputation: 81

As you are proxying all traffic to another server the simplest solution is to change the DNS record of sub.domain.com to match the DNS record of otherdomain.com.

In the Apache vHost at otherdomain.com add an ServerAlias directive for sub.domain.com. That way you get rid of the proxy stuff and all clients connect directly to the target server.

Upvotes: 1

Related Questions