Re: Redirect in Tomcat 5.5 Not Working
It worked. Thanks. Latesha Williams [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We are running Tomcat 5.5.20 as a standalone web server for a third-party's web and servlet applications. On this server (Linux), Iptables is redirecting ports 80 to 8080 and 443 to 8443 (to run Tomcat as regular user.) In addition, we are interested in configuring Tomcat so that requests to port 8080 (default ports for both applications) are automatically redirected to port 8443. After performing the following steps below, the redirect does not work. In a web browser, both ports (8080 8443) can be accessed directly, but only want port 8443 available for use. Any ideas on how to fix are appreciated. (1) Created a self-signed certificate and changed the default keystore pasword. (2) Un-commented the SSL HTTP/1.1 Connector section in server.xml (see below). Connector port=8443 maxHttpHeaderSize=8192 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 scheme=https secure=true clientAuth=false sslProtocol=TLS keystoreFile=/some/file/path keystorePass=somepassword / (3) In file, $CATALINA_HOME/conf/web.xml, added the following: security-constraint web-resource-collection web-resource-nameEntire Application/web-resource-name url-pattern*/url-pattern This should be url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection user-data-constraint transport-guaranteeCONFIDENTIAL/transport-guarantee /user-data-constraint /security-constraint (4)Restarted Tomcat. -- Latesha Williams Applications Support, Information Technology American Museum of Natural History [EMAIL PROTECTED] 212.769.5947 917.837.2460 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Latesha Williams Applications Support, Information Technology American Museum of Natural History [EMAIL PROTECTED] 212.769.5947 917.837.2460 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirect in Tomcat 5.5 Not Working
Latesha Williams [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We are running Tomcat 5.5.20 as a standalone web server for a third-party's web and servlet applications. On this server (Linux), Iptables is redirecting ports 80 to 8080 and 443 to 8443 (to run Tomcat as regular user.) In addition, we are interested in configuring Tomcat so that requests to port 8080 (default ports for both applications) are automatically redirected to port 8443. After performing the following steps below, the redirect does not work. In a web browser, both ports (8080 8443) can be accessed directly, but only want port 8443 available for use. Any ideas on how to fix are appreciated. (1) Created a self-signed certificate and changed the default keystore pasword. (2) Un-commented the SSL HTTP/1.1 Connector section in server.xml (see below). Connector port=8443 maxHttpHeaderSize=8192 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 scheme=https secure=true clientAuth=false sslProtocol=TLS keystoreFile=/some/file/path keystorePass=somepassword / (3) In file, $CATALINA_HOME/conf/web.xml, added the following: security-constraint web-resource-collection web-resource-nameEntire Application/web-resource-name url-pattern*/url-pattern This should be url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection user-data-constraint transport-guaranteeCONFIDENTIAL/transport-guarantee /user-data-constraint /security-constraint (4)Restarted Tomcat. -- Latesha Williams Applications Support, Information Technology American Museum of Natural History [EMAIL PROTECTED] 212.769.5947 917.837.2460 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect with tomcat
We've used UrlRewriteFilter with good success so far: http://tuckey.org/urlrewrite/ David Lothar Krenzien wrote: Hi there, I'm using tomcat 5.5 and want to redirect some requests to another URL. For example the URL localhost:80/siteA should be forwarded to localhost:8080/siteB. Of course on Port 8080 listen another web-server. Does anybody know a good explanation how to do that ? I've tried with filters in catalina_home/conf/web.xml and put the classes in the catalina_home/server/classes and also by defining forwarding-rules in a rules.xml file. But all with no success. Thanks for your answer. Lothar __ Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect with tomcat
Hi David , it looks interesting. But what I don't understand, when I define the filter in the project web.xml how does tomcat knows where to look when the entered url in the browser contains a project name which doesn't exits ? I think, when a user enters localhost:80/siteB I need to have a project in my webapp dir called projectB. What I want is, to redirect some specific urls to another server . My previous post contains a mistake : localhost:80/siteB should be forwared to localhost:8080/siteB because I don't have an app siteB, but the clients would like to use only one hostname. Thanks, Lothar -Ursprüngliche Nachricht- Von: Tomcat Users List users@tomcat.apache.org Gesendet: 16.03.06 19:36:46 An: Tomcat Users List users@tomcat.apache.org Betreff: Re: redirect with tomcat We've used UrlRewriteFilter with good success so far: http://tuckey.org/urlrewrite/ David Lothar Krenzien wrote: Hi there, I'm using tomcat 5.5 and want to redirect some requests to another URL. For example the URL localhost:80/siteA should be forwarded to localhost:8080/siteB. Of course on Port 8080 listen another web-server. Does anybody know a good explanation how to do that ? I've tried with filters in catalina_home/conf/web.xml and put the classes in the catalina_home/server/classes and also by defining forwarding-rules in a rules.xml file. But all with no success. Thanks for your answer. Lothar __ Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect with tomcat
Well, you should check out the url rewrite documention for details. In your webapp's web.xml, you put something like this in to tell it you want it to examine all URLs that come into the web app: filter filter-nameUrlRewriteFilter/filter-name filter-classorg.tuckey.web.filters.urlrewrite.UrlRewriteFilter/filter-class init-param param-namelogLevel/param-name param-valuelog4j/param-value /init-param init-param param-nameconfReloadCheckInterval/param-name param-value60/param-value /init-param /filter filter-mapping filter-nameUrlRewriteFilter/filter-name url-pattern/*/url-pattern /filter-mapping Note that I have set the logLevel to 'log4j' because that's what we use, but you can set it values like DEBUG, etc. or 'commons' if you use the commons logging. In the same WEB-INF location where web.xml is defined, you configure the urlrewrite.xml file, with something like: ?xml version=1.0 encoding=utf-8? !DOCTYPE urlrewrite PUBLIC -//tuckey.org//DTD UrlRewrite 2.5//EN http://tuckey.org/res/dtds/urlrewrite2.5.dtd; !-- Configuration file for UrlRewriteFilter http://tuckey.org/urlrewrite/ -- urlrewrite rule note Anything coming to / or any number of subsequent slashes should just go to the public site. /note from^/siteB(.*)$/from to type=redirecthttp://localhost:8080/sideB$1/to /rule Note that the actual rule depends a bit on where you define this. The above from entry assumes that /siteB is specified and being processed by the root webapp (context /). If you are defining url rewrite in a webapp with a context of '/siteB' then you would assume the /siteB/ context path and use a from of just: /(.*)$ No doubt there are better ways to configure it, but I'm not a URL rewrite expert. But what you are doing sounds very straightforward and it should work for you. David Lothar Krenzien wrote: Hi David , it looks interesting. But what I don't understand, when I define the filter in the project web.xml how does tomcat knows where to look when the entered url in the browser contains a project name which doesn't exits ? I think, when a user enters localhost:80/siteB I need to have a project in my webapp dir called projectB. What I want is, to redirect some specific urls to another server . My previous post contains a mistake : localhost:80/siteB should be forwared to localhost:8080/siteB because I don't have an app siteB, but the clients would like to use only one hostname. Thanks, Lothar -Ursprüngliche Nachricht- Von: Tomcat Users List users@tomcat.apache.org Gesendet: 16.03.06 19:36:46 An: Tomcat Users List users@tomcat.apache.org Betreff: Re: redirect with tomcat We've used UrlRewriteFilter with good success so far: http://tuckey.org/urlrewrite/ David Lothar Krenzien wrote: Hi there, I'm using tomcat 5.5 and want to redirect some requests to another URL. For example the URL localhost:80/siteA should be forwarded to localhost:8080/siteB. Of course on Port 8080 listen another web-server. Does anybody know a good explanation how to do that ? I've tried with filters in catalina_home/conf/web.xml and put the classes in the catalina_home/server/classes and also by defining forwarding-rules in a rules.xml file. But all with no success. Thanks for your answer. Lothar __ Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]