You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Mathias P.W Nilsson" <ma...@snyltarna.se> on 2008/06/23 20:17:58 UTC

Pointers in tomcat

Hi!

I have a web page that is deployed as ROOT.war. In my web app I have created
a connector for https that points to the www.mysite.com. My problem is that
I also want it to point to mysite.com without the www. I have only bought
www.mysite.com from thawte so the browser complains about the mysite.com. Is
there anyway of redirecting mysite.com to www.mysite.com?


-- 
View this message in context: http://www.nabble.com/Pointers-in-tomcat-tp18075070p18075070.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers in tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mathias,

Mathias P.W Nilsson wrote:
| I have a web page that is deployed as ROOT.war. In my web app I have
created
| a connector for https that points to the www.mysite.com. My problem is
that
| I also want it to point to mysite.com without the www. I have only bought
| www.mysite.com from thawte so the browser complains about the
mysite.com. Is
| there anyway of redirecting mysite.com to www.mysite.com?

Did you really only buy WWW.MYSITE.COM and not just MYSITE.COM? I didn't
know you could buy a sub-level without buying a top-level. Every site
I've purchased in the past has been of the form MYSITE.COM and then I
was free to define *.MYSITE.COM to my choosing.

If you really don't own MYSITE.COM, then there's nothing you can do to
get it to redirect to WWW.MYSITE.COM.

If, as I suspect, you *do* own MYSITE.COM, you just need to set up a
default virtual host and have it redirect to WWW.MYSITE.COM.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhf7JgACgkQ9CaO5/Lv0PD7HgCaA+PBVRE6zSdOviaVqAilrooj
kCsAoJqaOI6j0JNzkfA61N4XVWUWZ+Wb
=pMku
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers in tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mathias,

Mathias P.W Nilsson wrote:
|> If, as I suspect, you *do* own MYSITE.COM, you just need to set up a
|> default virtual host and have it redirect to WWW.MYSITE.COM.
|>
|
| How can I do this? My web app points to ROOT.war.
|
| <Host name="localhost"  appBase="webapps"
|             unpackWARs="true" autoDeploy="true"
|             xmlValidation="false" xmlNamespaceAware="false">
| 		<Alias>www.mysite.com</Alias>
|  		<Alias>mysite.com</Alias>
|       </Host>

Unfortunately, Tomcat doesn't really have anything like Apache httpd's
"RedirectPermanent" directive that you can assign at the server (or
virtual host) level. Instead, you have to create a tiny webapp that does
this for you:

1. Create a <Host> that matches only "mysite.com" and does not alias
www.mysite.com. You might want to make this one the default, so you
catch any other hostnames that come in.

2. Create a ROOT webapp for that host and ...

3. Use a url rewriting library like http://tuckey.org/urlrewrite/ or
write your own simple redirection code

4. Deploy your real application on a the <Host> that matches only
"www.mysite.com".

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhf+ZAACgkQ9CaO5/Lv0PA5CACdFkkRK9c5+i9KPhgMb+y61jM4
x9MAnRJ1kSm4FJlTMr1mC4ArhQS2Rs6j
=FVve
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Pointers in tomcat

Posted by Philip Wigg <ph...@philipwigg.co.uk>.
> How can I do this? My web app points to ROOT.war.
>
> <Host name="localhost"  appBase="webapps"
>            unpackWARs="true" autoDeploy="true"
>            xmlValidation="false" xmlNamespaceAware="false">
>                <Alias>www.mysite.com</Alias>
>                <Alias>mysite.com</Alias>
>      </Host>

If you're hitting the same server through both URLs then your DNS
sounds like it's fine. So now you just need to configure your
application to redirect requests from http://mysite.com to
http://www.mysite.com.You could do this using the urlRewriteFilter:-

http://tuckey.org/urlrewrite/

Or alternatively if you're using Apache you could do it through mod_rewrite.

Cheers,
Phil.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Pointers in tomcat

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.



> If, as I suspect, you *do* own MYSITE.COM, you just need to set up a 
> default virtual host and have it redirect to WWW.MYSITE.COM. 
> 

How can I do this? My web app points to ROOT.war.

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
		<Alias>www.mysite.com</Alias>
 		<Alias>mysite.com</Alias>
      </Host>



-- 
View this message in context: http://www.nabble.com/Pointers-in-tomcat-tp18075070p18075809.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Pointers in tomcat

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
I own the domain but didn't buy a wildcard certificate. So the only thing
that works is www.mysite.com for the certificate. When I type mysite.com I
get to the same server but it is not ssl enabled
-- 
View this message in context: http://www.nabble.com/Pointers-in-tomcat-tp18075070p18075744.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org