You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Darren Kukulka <da...@oneserve.co.uk> on 2011/06/16 19:04:37 UTC

[users@httpd] Subdomain redirection in Apache Virtual Hosting

Hi All,

I have a general question regarding subdomain redirection with virtual
hosts.

Basically, we have a domain - let's call it sample.com - with several
subdomains, xxx.sample.com and yyy.sample.com

At the momend www.sample.com takes people to a website hosted elsewhere

We need to have anybody hitting xxx.sample.com and yyy.sample.com redirected
to their respective applications - running under Tomcat and reached by AJP
connectors - through a single Apache web server (2.2.17) with mod_jk
connector (1.2.2).

That is, the virtual host definitions should parse the incoming URL, and use
AJP worker1 to direct traffic to Tomcat on another server running the
application for xxx.sample.com.....and use AJP worker2 to direct traffic to
Tomcat on yet another server running the application for yyy.sample.com

Plus, we want anybody browsing to xxx.sample.com or yyy.sample.com to have
any redirection hidden from their URL, i.e. rather than seeing
https://xxx.sample.com/xxx-application/login.jsp , they would see
https://xxx.sample.com/login.jsp

Been looking into mod_rewrite and mod_proxy (for proxypass and
proxypass_reverse for hiding actual URLs)...but I think I'm getting
overloaded with information!

There is already a wildcard SSL certificate in place for *.sample.com. so
that's all OK...and the AJP connections appear to work fine as well...it's
just getting this darned subdomain config tied down.

Can anybody suggest a clean way to acheive this?

Many Thanks,
Daz

Re: [users@httpd] Subdomain redirection in Apache Virtual Hosting

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 06/17/2011 09:45 AM, Darren Kukulka wrote:
> Sorry, I thought I was clear that I'm looking for suggestions on how 
> to acheive the subdomain redirection in virtual hosting...
>

There is no such thing as a "subdomain";all vhosts have hostnames.

Just define a new vhost with the additional hostname (assuming you now 
have nameVirtualHost *:80, which you should):

<VirtualHost *:80>
     ServerName my.sub.domain
     Documentroot /some/where/else
</VirtualHost>


> I'm not well versed in mod_rewrite and regular expressions, etc
>
> On 16 June 2011 18:38, Jeroen Geilman <jeroen@adaptr.nl 
> <ma...@adaptr.nl>> wrote:
>
>     On 06/16/2011 07:04 PM, Darren Kukulka wrote:
>>     Hi All,
>>
>>     I have a general question regarding subdomain redirection with
>>     virtual hosts.
>>
>>     Basically, we have a domain - let's call it sample.com
>>     <http://sample.com> - with several subdomains, xxx.sample.com
>>     <http://xxx.sample.com> and yyy.sample.com <http://yyy.sample.com>
>>
>>     At the momend www.sample.com <http://www.sample.com> takes people
>>     to a website hosted elsewhere
>>
>>     We need to have anybody hitting xxx.sample.com
>>     <http://xxx.sample.com> and yyy.sample.com
>>     <http://yyy.sample.com> redirected to their respective
>>     applications - running under Tomcat and reached by AJP connectors
>>     - through a single Apache web server (2.2.17) with mod_jk
>>     connector (1.2.2).
>>
>>     That is, the virtual host definitions should parse the incoming
>>     URL, and use AJP worker1 to direct traffic to Tomcat on another
>>     server running the application for xxx.sample.com.....and use AJP
>>     worker2 to direct traffic to Tomcat on yet another server running
>>     the application for yyy.sample.com <http://yyy.sample.com>
>>
>>     Plus, we want anybody browsing to xxx.sample.com
>>     <http://xxx.sample.com> or yyy.sample.com <http://yyy.sample.com>
>>     to have any redirection hidden from their URL, i.e. rather than
>>     seeing https://xxx.sample.com/xxx-application/login.jsp , they
>>     would see https://xxx.sample.com/login.jsp
>>
>>     Been looking into mod_rewrite and mod_proxy (for proxypass and
>>     proxypass_reverse for hiding actual URLs)...but I think I'm
>>     getting overloaded with information!
>>
>>     There is already a wildcard SSL certificate in place for
>>     *.sample.com <http://sample.com>. so that's all OK...and the AJP
>>     connections appear to work fine as well...it's just getting this
>>     darned subdomain config tied down.
>>
>>     Can anybody suggest a clean way to acheive this?
>>
>>     Many Thanks,
>>     Daz
>
>
>     So what isn't working the way you expected ?
>
>
>
>     -- 
>     J.
>
>


-- 
J.


Re: [users@httpd] Subdomain redirection in Apache Virtual Hosting

Posted by Darren Kukulka <da...@oneserve.co.uk>.
Sorry, I thought I was clear that I'm looking for suggestions on how to
acheive the subdomain redirection in virtual hosting...

I'm not well versed in mod_rewrite and regular expressions, etc

On 16 June 2011 18:38, Jeroen Geilman <je...@adaptr.nl> wrote:

> **
> On 06/16/2011 07:04 PM, Darren Kukulka wrote:
>
> Hi All,
>
> I have a general question regarding subdomain redirection with virtual
> hosts.
>
> Basically, we have a domain - let's call it sample.com - with several
> subdomains, xxx.sample.com and yyy.sample.com
>
> At the momend www.sample.com takes people to a website hosted elsewhere
>
> We need to have anybody hitting xxx.sample.com and yyy.sample.comredirected to their respective applications - running under Tomcat and
> reached by AJP connectors - through a single Apache web server (2.2.17) with
> mod_jk connector (1.2.2).
>
> That is, the virtual host definitions should parse the incoming URL, and
> use AJP worker1 to direct traffic to Tomcat on another server running the
> application for xxx.sample.com.....and use AJP worker2 to direct traffic to
> Tomcat on yet another server running the application for yyy.sample.com
>
> Plus, we want anybody browsing to xxx.sample.com or yyy.sample.com to have
> any redirection hidden from their URL, i.e. rather than seeing
> https://xxx.sample.com/xxx-application/login.jsp , they would see
> https://xxx.sample.com/login.jsp
>
> Been looking into mod_rewrite and mod_proxy (for proxypass and
> proxypass_reverse for hiding actual URLs)...but I think I'm getting
> overloaded with information!
>
> There is already a wildcard SSL certificate in place for *.sample.com. so
> that's all OK...and the AJP connections appear to work fine as well...it's
> just getting this darned subdomain config tied down.
>
> Can anybody suggest a clean way to acheive this?
>
> Many Thanks,
> Daz
>
>
>
> So what isn't working the way you expected ?
>
>
>
> --
> J.
>
>

Re: [users@httpd] Subdomain redirection in Apache Virtual Hosting

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 06/16/2011 07:04 PM, Darren Kukulka wrote:
> Hi All,
>
> I have a general question regarding subdomain redirection with virtual 
> hosts.
>
> Basically, we have a domain - let's call it sample.com 
> <http://sample.com> - with several subdomains, xxx.sample.com 
> <http://xxx.sample.com> and yyy.sample.com <http://yyy.sample.com>
>
> At the momend www.sample.com <http://www.sample.com> takes people to a 
> website hosted elsewhere
>
> We need to have anybody hitting xxx.sample.com <http://xxx.sample.com> 
> and yyy.sample.com <http://yyy.sample.com> redirected to their 
> respective applications - running under Tomcat and reached by AJP 
> connectors - through a single Apache web server (2.2.17) with mod_jk 
> connector (1.2.2).
>
> That is, the virtual host definitions should parse the incoming URL, 
> and use AJP worker1 to direct traffic to Tomcat on another server 
> running the application for xxx.sample.com.....and use AJP worker2 to 
> direct traffic to Tomcat on yet another server running the application 
> for yyy.sample.com <http://yyy.sample.com>
>
> Plus, we want anybody browsing to xxx.sample.com 
> <http://xxx.sample.com> or yyy.sample.com <http://yyy.sample.com> to 
> have any redirection hidden from their URL, i.e. rather than seeing 
> https://xxx.sample.com/xxx-application/login.jsp , they would see 
> https://xxx.sample.com/login.jsp
>
> Been looking into mod_rewrite and mod_proxy (for proxypass and 
> proxypass_reverse for hiding actual URLs)...but I think I'm getting 
> overloaded with information!
>
> There is already a wildcard SSL certificate in place for *.sample.com 
> <http://sample.com>. so that's all OK...and the AJP connections appear 
> to work fine as well...it's just getting this darned subdomain config 
> tied down.
>
> Can anybody suggest a clean way to acheive this?
>
> Many Thanks,
> Daz


So what isn't working the way you expected ?



-- 
J.