Re: Regarding Tomcat url redirection

2024-05-22 Thread lavanya tech
Put both applications into webapps/ with no 
> elements in server.xml and let them deploy. Use the correct URLs to
> access them. It's obviously some internal thing to your company because
> nobody is going to use :8443 in the real world.
>
> I'm sorry, but it seems like you are being given arbitrary and weird
> requirements almost as a game.
>
> I'm not sure I can help you any further at this point.
>
> -chris
>
> > On Wed, May 15, 2024 at 2:16 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Lavanya,
> >>
> >> On 5/15/24 04:43, lavanya tech wrote:
> >>> Though to write you privately, regaridng the tomcat url redirection as
> >>> the mail chain is getting more big big
> >>
> >> It's better to post to the list, so anyone in your situation can learn
> >> from it.
> >>
> >>> Let me know if its fine for you and here is what I did.
> >>>
> >>> 1)   >>> autoDeploy="true">
> >>> 
> >>
> >> Don't do this. Just put towl.war into webapps/ and let it auto-deploy.
> >> What you are doing here is double-deploying your "towl" application:
> >> once as "" (ROOT) and once as "/towl". Remove this from server.xml.
> >>
> >>> 
> >>>  >>> className="org.apache.catalina.valves.rewrite.RewriteValve" />
> >>
> >> Okay.
> >>
> >>> 2) I have towl application and towl.war under webapps directory
> >>> 3) added  proxy port and proxyname to connector
> >>>
> >>>>>> protocol="org.apache.coyote.http11.Http11NioProtocol"
> >>>  maxThreads="150" SSLEnabled="true">
> >>>  proxyPort="8443" proxyName="server.lbg.com
> >>> <http://server.lbg.com>">
> >>>>>> className="org.apache.coyote.http2.Http2Protocol" />
> >>>   
> >>>>>>certificateKeystorePassword="pass"
> >>>type="RSA" />
> >>>   
> >>>   
> >>
> >> Okay.
> >>
> >>> 4) added rewrite.config under conf directory
> >>>   > # Redirect everything that is not server.lbg.com
> >>> <http://server.lbg.com> to
> >>>   > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl
> >> yet.
> >>>   > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
> >>>   > RewriteRule ^/(.*) https://server.lbg.com:8443/$1
> >>> <https://server.lbg.com:8443/$1> [L]
> >>>   >
> >>>   > # Redirect anything that isn't already going to /towl
> >>>   > # to go to /towl
> >>>   > RewriteCond %{REQUEST_URI} !^/towl
> >>>   > RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1
> >>> <https://server.lbg.com:8443/towl/$1> [L]
> >>>
> >>> 5) restarted tomcat
> >>> 6) can access all the urls https://server.lbg.com:8443
> >>> <https://server.lbg.com:8443>, https://server.lbg.com
> >>> <https://server.lbg.com>, https://server.lbg.com:8443/towl
> >>> <https://server.lbg.com:8443/towl>, https://server.lbg.com/towl
> >>> <https://server.lbg.com/towl>
> >>> https://example.lbg.com:8443 <https://example.lbg.com:8443>,
> >>> https://example.lbg.com <https://example.lbg.com>,
> >>> https://example.lbg.com:8443/towl <https://example.lbg.com:8443/towl>,
> >>> https://example.lbg.com/towl <https://example.lbg.com/towl>
> >>>
> >>> Unfortunately aliasing still doesnot work https://example.lbg.com
> >>> <https://example.lbg.com> --> https://server.lbg.com:8443/towl
> >>> <https://server.lbg.com:8443/towl> and many urls works
> >>
> >> The "aliasing" will always be weird. IMO it's better to redirect. If you
> >> change to redirect, does everything *work*, even if you don't like how
> >> the browser's URL bar displays?
> >>
> >> -chris
> >>
> >>> On Tue, May 14, 2024 at 11:38 PM Christopher Schultz
> >>> mailto:ch...@christopherschultz.net>>
> >> wrote:
> >&g

Re: Regarding Tomcat url redirection

2024-05-16 Thread Christopher Schultz

Lavanya,

On 5/15/24 09:09, lavanya tech wrote:

Hi Chris,





If i remove this from server.xml file i have the below error.

Message java.lang.NoClassDefFoundError: org/towl/indexer/web/Prefix

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception

jakarta.servlet.ServletException: java.lang.NoClassDefFoundError:
org/towl/indexer/web/Prefix
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


That smells like a CLASSPATH problem where your application is not 
actually packaged properly. It could be something else, but it looks 
suspicious.



The "aliasing" will always be weird. IMO it's better to redirect. If you
change to redirect, does everything *work*, even if you don't like how
the browser's URL bar displays?
   --> I tried but it didnot work
ok apart from this tpic , we have one more issue found.


Actually application team, they are deploying two applications one with
towl (which you are already aware) the other one is (towl-app) they have
defined seperate server.xml for both.


Separate server.xml files means that you have to have two separate 
Tomcat processes.



Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example.lbg.com


Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example-app.lbg.com

which means we have two aliases for server.lbg.com , earlier we were
concentrating only on one example.lbg.com , now i wanted to somehow enable
access as the same for the other one also
https://example-app.lbg.com --> https://server.lbg.com:8444/towl-app

So i created iptable rule in the sameway as before redirect 443 to 8444 and
i have the urls working same as example.lbg.com

Both the server.xml files are here

/git/towl/apachetomcat/conf/server.xml
/git/towl-app/apachetomcat/conf/server.xml --> I changed the port of
connectors and everything

But now when i try to access https://example.lbg.com --> I get webpage of
https://example-app.lbg.com and sometimes i get webpage of
https://example.lbg.com after refresh itself which is wierd

May i know why this is happening. If we fix this then I am thinking to
disable the unwated urls leaving the required ones. for example the below
ones. I think that would be easier ? rather than redirecting or aliasing-->
Because we noticed that towl application is already pointing with
https://example.lbg.com

https://server.lbg.com:8443
   https://example-lbg.com:8443
   <https://example.lbg.com/towl>
<https://server.lbg.com/towl>
https://server.lbg.com:8444
   https://example-lbg.com:8444
   <https://example.lbg.com/towl-app>
<https://server.lbg.com/towl-app>

kindly suggest us a fix.


The best fix is to deploy the two applications normally without any 
funny business. Put both applications into webapps/ with no  
elements in server.xml and let them deploy. Use the correct URLs to 
access them. It's obviously some internal thing to your company because 
nobody is going to use :8443 in the real world.


I'm sorry, but it seems like you are being given arbitrary and weird 
requirements almost as a game.


I'm not sure I can help you any further at this point.

-chris


On Wed, May 15, 2024 at 2:16 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Lavanya,

On 5/15/24 04:43, lavanya tech wrote:

Though to write you privately, regaridng the tomcat url redirection as
the mail chain is getting more big big


It's better to post to the list, so anyone in your situation can learn
from it.


Let me know if its fine for you and here is what I did.

1)  



Don't do this. Just put towl.war into webapps/ and let it auto-deploy.
What you are doing here is double-deploying your "towl" application:
once as "" (ROOT) and once as "/towl". Remove this from server.xml.






Okay.


2) I have towl application and towl.war under webapps directory
3) added  proxy port and proxyname to connector

  
 proxyPort="8443" proxyName="server.lbg.com
<http://server.lbg.com>">
  
  
  
  
  


Okay.


4) added rewrite.config under conf directory
  > # Redirect everything that is not server.lbg.com
<http://server.lbg.com> to
  > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl

yet.

  > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
  > RewriteRule ^/(.*) https://server.lbg.com:8443/$1
<https://server.lbg.com:8443/$1> [L]
  >
  > # Redirect anything that isn't already going to /towl
  > # to go to /towl
  > RewriteCond %{REQUEST_URI} !^/towl
  > RewriteRule ^/(.*) https://server.lbg.com

Re: Regarding Tomcat url redirection

2024-05-16 Thread Christopher Schultz

Lavanya,

On 5/15/24 09:09, lavanya tech wrote:

Hi Chris,





If i remove this from server.xml file i have the below error.

Message java.lang.NoClassDefFoundError: org/towl/indexer/web/Prefix

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception

jakarta.servlet.ServletException: java.lang.NoClassDefFoundError:
org/towl/indexer/web/Prefix
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


That smells like a CLASSPATH problem where your application is not 
actually packaged properly. It could be something else, but it looks 
suspicious.



The "aliasing" will always be weird. IMO it's better to redirect. If you
change to redirect, does everything *work*, even if you don't like how
the browser's URL bar displays?
   --> I tried but it didnot work
ok apart from this tpic , we have one more issue found.


Actually application team, they are deploying two applications one with
towl (which you are already aware) the other one is (towl-app) they have
defined seperate server.xml for both.


Separate server.xml files means that you have to have two separate 
Tomcat processes.



Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example.lbg.com


Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example-app.lbg.com

which means we have two aliases for server.lbg.com , earlier we were
concentrating only on one example.lbg.com , now i wanted to somehow enable
access as the same for the other one also
https://example-app.lbg.com --> https://server.lbg.com:8444/towl-app

So i created iptable rule in the sameway as before redirect 443 to 8444 and
i have the urls working same as example.lbg.com

Both the server.xml files are here

/git/towl/apachetomcat/conf/server.xml
/git/towl-app/apachetomcat/conf/server.xml --> I changed the port of
connectors and everything

But now when i try to access https://example.lbg.com --> I get webpage of
https://example-app.lbg.com and sometimes i get webpage of
https://example.lbg.com after refresh itself which is wierd

May i know why this is happening. If we fix this then I am thinking to
disable the unwated urls leaving the required ones. for example the below
ones. I think that would be easier ? rather than redirecting or aliasing-->
Because we noticed that towl application is already pointing with
https://example.lbg.com

https://server.lbg.com:8443
   https://example-lbg.com:8443
   <https://example.lbg.com/towl>
<https://server.lbg.com/towl>
https://server.lbg.com:8444
   https://example-lbg.com:8444
   <https://example.lbg.com/towl-app>
<https://server.lbg.com/towl-app>

kindly suggest us a fix.


The best fix is to deploy the two applications normally without any 
funny business. Put both applications into webapps/ with no  
elements in server.xml and let them deploy. Use the correct URLs to 
access them. It's obviously some internal thing to your company because 
nobody is going to use :8443 in the real world.


I'm sorry, but it seems like you are being given arbitrary and weird 
requirements almost as a game.


I'm not sure I can help you any further at this point.

-chris


On Wed, May 15, 2024 at 2:16 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Lavanya,

On 5/15/24 04:43, lavanya tech wrote:

Though to write you privately, regaridng the tomcat url redirection as
the mail chain is getting more big big


It's better to post to the list, so anyone in your situation can learn
from it.


Let me know if its fine for you and here is what I did.

1)  



Don't do this. Just put towl.war into webapps/ and let it auto-deploy.
What you are doing here is double-deploying your "towl" application:
once as "" (ROOT) and once as "/towl". Remove this from server.xml.






Okay.


2) I have towl application and towl.war under webapps directory
3) added  proxy port and proxyname to connector

  
 proxyPort="8443" proxyName="server.lbg.com
<http://server.lbg.com>">
  
  
  
  
  


Okay.


4) added rewrite.config under conf directory
  > # Redirect everything that is not server.lbg.com
<http://server.lbg.com> to
  > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl

yet.

  > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
  > RewriteRule ^/(.*) https://server.lbg.com:8443/$1
<https://server.lbg.com:8443/$1> [L]
  >
  > # Redirect anything that isn't already going to /towl
  > # to go to /towl
  > RewriteCond %{REQUEST_URI} !^/towl
  > RewriteRule ^/(.*) https://server.lbg.com

Re: Regarding Tomcat url redirection

2024-05-15 Thread lavanya tech
Hi Chris,

>

If i remove this from server.xml file i have the below error.

Message java.lang.NoClassDefFoundError: org/towl/indexer/web/Prefix

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception

jakarta.servlet.ServletException: java.lang.NoClassDefFoundError:
org/towl/indexer/web/Prefix
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

The "aliasing" will always be weird. IMO it's better to redirect. If you
change to redirect, does everything *work*, even if you don't like how
the browser's URL bar displays?
  --> I tried but it didnot work
ok apart from this tpic , we have one more issue found.


Actually application team, they are deploying two applications one with
towl (which you are already aware) the other one is (towl-app) they have
defined seperate server.xml for both.

Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example.lbg.com


Name:server.lbg.com
Address:  192.168.200.120
Aliases:  example-app.lbg.com

which means we have two aliases for server.lbg.com , earlier we were
concentrating only on one example.lbg.com , now i wanted to somehow enable
access as the same for the other one also
https://example-app.lbg.com --> https://server.lbg.com:8444/towl-app

So i created iptable rule in the sameway as before redirect 443 to 8444 and
i have the urls working same as example.lbg.com

Both the server.xml files are here

/git/towl/apachetomcat/conf/server.xml
/git/towl-app/apachetomcat/conf/server.xml --> I changed the port of
connectors and everything

But now when i try to access https://example.lbg.com --> I get webpage of
https://example-app.lbg.com and sometimes i get webpage of
https://example.lbg.com after refresh itself which is wierd

May i know why this is happening. If we fix this then I am thinking to
disable the unwated urls leaving the required ones. for example the below
ones. I think that would be easier ? rather than redirecting or aliasing-->
Because we noticed that towl application is already pointing with
https://example.lbg.com

   https://server.lbg.com:8443
  https://example-lbg.com:8443
  <https://example.lbg.com/towl>
<https://server.lbg.com/towl>
   https://server.lbg.com:8444
  https://example-lbg.com:8444
  <https://example.lbg.com/towl-app>
<https://server.lbg.com/towl-app>

kindly suggest us a fix.

Thanks once again for your time

Regards,
Lavanya




On Wed, May 15, 2024 at 2:16 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Lavanya,
>
> On 5/15/24 04:43, lavanya tech wrote:
> > Though to write you privately, regaridng the tomcat url redirection as
> > the mail chain is getting more big big
>
> It's better to post to the list, so anyone in your situation can learn
> from it.
>
> > Let me know if its fine for you and here is what I did.
> >
> > 1)   > autoDeploy="true">
> >
>
> Don't do this. Just put towl.war into webapps/ and let it auto-deploy.
> What you are doing here is double-deploying your "towl" application:
> once as "" (ROOT) and once as "/towl". Remove this from server.xml.
>
> >
> > > className="org.apache.catalina.valves.rewrite.RewriteValve" />
>
> Okay.
>
> > 2) I have towl application and towl.war under webapps directory
> > 3) added  proxy port and proxyname to connector
> >
> >   > protocol="org.apache.coyote.http11.Http11NioProtocol"
> > maxThreads="150" SSLEnabled="true">
> > proxyPort="8443" proxyName="server.lbg.com
> > <http://server.lbg.com>">
> >   > className="org.apache.coyote.http2.Http2Protocol" />
> >  
> >   >   certificateKeystorePassword="pass"
> >   type="RSA" />
> >  
> >  
>
> Okay.
>
> > 4) added rewrite.config under conf directory
> >  > # Redirect everything that is not server.lbg.com
> > <http://server.lbg.com> to
> >  > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl
> yet.
> >  > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
> >  > RewriteRule ^/(.*) https://server.lbg.com:8443/$1
> > <https://server.lbg.com:8443/$1> [L]
> >  >
> >  > # Redirect anything that isn't already going to /towl
> >  > # to go to /towl
> >  >

Re: Regarding Tomcat url redirection

2024-05-15 Thread Christopher Schultz

Lavanya,

On 5/15/24 04:43, lavanya tech wrote:
Though to write you privately, regaridng the tomcat url redirection as 
the mail chain is getting more big big


It's better to post to the list, so anyone in your situation can learn 
from it.



Let me know if its fine for you and here is what I did.

1)      autoDeploy="true">

           


Don't do this. Just put towl.war into webapps/ and let it auto-deploy. 
What you are doing here is double-deploying your "towl" application: 
once as "" (ROOT) and once as "/towl". Remove this from server.xml.



           
           className="org.apache.catalina.valves.rewrite.RewriteValve" />


Okay.


2) I have towl application and towl.war under webapps directory
3) added  proxy port and proxyname to connector

     protocol="org.apache.coyote.http11.Http11NioProtocol"

                maxThreads="150" SSLEnabled="true">
                proxyPort="8443" proxyName="server.lbg.com 
<http://server.lbg.com>">
         className="org.apache.coyote.http2.Http2Protocol" />

         
             
         
     


Okay.


4) added rewrite.config under conf directory
 > # Redirect everything that is not server.lbg.com 
<http://server.lbg.com> to

 > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl yet.
 > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
 > RewriteRule ^/(.*) https://server.lbg.com:8443/$1 
<https://server.lbg.com:8443/$1> [L]

 >
 > # Redirect anything that isn't already going to /towl
 > # to go to /towl
 > RewriteCond %{REQUEST_URI} !^/towl
 > RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 
<https://server.lbg.com:8443/towl/$1> [L]


5) restarted tomcat
6) can access all the urls https://server.lbg.com:8443 
<https://server.lbg.com:8443>, https://server.lbg.com 
<https://server.lbg.com>, https://server.lbg.com:8443/towl 
<https://server.lbg.com:8443/towl>, https://server.lbg.com/towl 
<https://server.lbg.com/towl>
https://example.lbg.com:8443 <https://example.lbg.com:8443>, 
https://example.lbg.com <https://example.lbg.com>, 
https://example.lbg.com:8443/towl <https://example.lbg.com:8443/towl>, 
https://example.lbg.com/towl <https://example.lbg.com/towl>


Unfortunately aliasing still doesnot work https://example.lbg.com 
<https://example.lbg.com> --> https://server.lbg.com:8443/towl 
<https://server.lbg.com:8443/towl> and many urls works


The "aliasing" will always be weird. IMO it's better to redirect. If you 
change to redirect, does everything *work*, even if you don't like how 
the browser's URL bar displays?


-chris

On Tue, May 14, 2024 at 11:38 PM Christopher Schultz 
mailto:ch...@christopherschultz.net>> wrote:


Lavanya,

On 5/14/24 15:11, lavanya tech wrote:
 > You are right. We need aliasing here which means the URL in the
browser
 > does not change.
 > May I know where should I put the below rewrite files ?
 >
 > # Redirect everything that is not server.lbg.com
<http://server.lbg.com> to
 > # server.lbg.com <http://server.lbg.com>. Don't worry about /towl
yet.
 > RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
 > RewriteRule ^/(.*) https://server.lbg.com:8443/$1
<https://server.lbg.com:8443/$1> [R=301,L]
 >
 > # Redirect anything that isn't already going to /towl
 > # to go to /towl
 > RewriteCond %{REQUEST_URI} !^/towl
 > RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1
<https://server.lbg.com:8443/towl/$1> [R=301,L]

AIUI, you can put all of the above in conf/rewrite.config and configure
the  under your  just as you had it before.

If you want aliasing and not redirection, then you don't want the [R]
flag. IMO, you should really do a redirect. If you don't, then the
application and the browser disagree about the base URL and all
kinds of
things like that.

-chris

 > On Tuesday, May 14, 2024, Christopher Schultz
mailto:ch...@christopherschultz.net>>
 > wrote:
 >
 >> Lavanya,
 >>
 >> On 5/14/24 09:12, lavanya tech wrote:
 >>
 >>> IMHO removing the port number is always the preferred solution
— I never
 >>>> did it
 >>>>
 >>>>
 >>>>> can we achieve this with tomcat or we need to setup an
reverse proxy
 >>>>> here.
 >>>>>
 >>>>>
 >>>> Your application uses whatever internal URLs it wants. Are you
building
 >>>> those yourself, or are you asking Tomcat for the e.g.
h

Re: Regarding Tomcat url redirection

2024-05-14 Thread Christopher Schultz

Lavanya,

On 5/14/24 15:11, lavanya tech wrote:

You are right. We need aliasing here which means the URL in the browser
does not change.
May I know where should I put the below rewrite files ?

# Redirect everything that is not server.lbg.com to
# server.lbg.com. Don't worry about /towl yet.
RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
RewriteRule ^/(.*) https://server.lbg.com:8443/$1 [R=301,L]

# Redirect anything that isn't already going to /towl
# to go to /towl
RewriteCond %{REQUEST_URI} !^/towl
RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 [R=301,L]


AIUI, you can put all of the above in conf/rewrite.config and configure 
the  under your  just as you had it before.


If you want aliasing and not redirection, then you don't want the [R] 
flag. IMO, you should really do a redirect. If you don't, then the 
application and the browser disagree about the base URL and all kinds of 
things like that.


-chris


On Tuesday, May 14, 2024, Christopher Schultz 
wrote:


Lavanya,

On 5/14/24 09:12, lavanya tech wrote:


IMHO removing the port number is always the preferred solution — I never

did it



can we achieve this with tomcat or we need to setup an reverse proxy
here.



Your application uses whatever internal URLs it wants. Are you building
those yourself, or are you asking Tomcat for the e.g. hostname, etc.? If
it's Tomcat, this is where the proxyName and proxyPort come in.



   - Yes, I have not built these UrLs before. It’s was working from the
very
beginning. As. I mentioned we are not able to reach goal or whatever.

Rather than saying redirection, I would say it’s aliasing.



Please be specific. "Aliasing" (to me) means "the URL does to the right
place but doesn't change in the browser's URL" and "redirection" (to
everybody) means "HTTP 301 or 302 response to a new URL".

Instead of moving applications or changing tomcat configuration it’s easier

to achieve with reverse proxy ?

https://example.lbg.com/ to https://server.lbg.com:8443/towl



This will be a nightmare. Do not try to rewrite URLs using a reverse
proxy. You should redirect users to the right place if necessary. You can
use a reverse-proxy if you want, but it won't be any less complicated than
having Tomcat do it.

I think your rewrite.config file just needs a few tweaks:

# Redirect everything that is not server.lbg.com to
# server.lbg.com. Don't worry about /towl yet.
RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
RewriteRule ^/(.*) https://server.lbg.com:8443/$1 [R=301,L]

# Redirect anything that isn't already going to /towl
# to go to /towl
RewriteCond %{REQUEST_URI} !^/towl
RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 [R=301,L]

The application should be deployed as towl.war (or towl/ directory). You
should listen on ports 80, 443, and 8443, and you should always end up at
the right place. You should have proxyPort="8443" and proxyName="
server.lbg.com" in your .

You will not need a ROOT context, since the rewrite will take care of that
for you.

-chris

On Mon, May 13, 2024 at 10:17 PM lavanya tech 

wrote:

Hi Chris,

Sorry, If I did confuse. It’s important that
https://server.lbg.com:8443/towl is always working. Goal is not to
disable /towl, but just redirect or aliasing

https//example.lbg.com/ to https://server.lbg.com:8443/towl




Thanks,
Lavanya

On Monday, May 13, 2024, Christopher Schultz <
ch...@christopherschultz.net



wrote:


Lavanya,

On 5/13/24 05:57, lavanya tech wrote:

Somehow made it work now i can only access urls as you mentioned before
https://example.lbg.com and https://server.lbg.com with port 8443 and
with
out

 https://example.lbg.com/towl and https://server.lbg.com/towl --> I
have an
error now File not found.

So i think we need to make work https://example.lbg.com/ to
https://server.lbg.com/towl


I'm sorry, I'm still confused as to which way you want things.

Do you want to redirect /towl -> / or do you want to redirect / - >
/towl?

Or does it depend upon the hostname? It would really be better if you
could settle on one specific beahvior.

-chris

On Mon, May 13, 2024 at 9:41 AM lavanya tech 

wrote:

Hi Chris,


Where are you defining the RewriteValve itself?

Defined rewritevalve here
  

  
 resource="conf/rewrite.config" />

2) reated rewrite.config and added as below under conf/

 RewriteCond %{REQUEST_URI} ^/towl/(.*)
 RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
already have this mappings /* in web.xml file)

   
  
Logging Area

Authentication for registered users.

/*
/api/v1/search 
/api/v1/suggest/* 
  

LDAP_USER
api



4) 

Re: Regarding Tomcat url redirection

2024-05-14 Thread lavanya tech
Hi Chris,

You are right. We need aliasing here which means the URL in the browser
does not change.
May I know where should I put the below rewrite files ?

# Redirect everything that is not server.lbg.com to
# server.lbg.com. Don't worry about /towl yet.
RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
RewriteRule ^/(.*) https://server.lbg.com:8443/$1 [R=301,L]

# Redirect anything that isn't already going to /towl
# to go to /towl
RewriteCond %{REQUEST_URI} !^/towl
RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 [R=301,L]

Thanks,
Lavanya

On Tuesday, May 14, 2024, Christopher Schultz 
wrote:

> Lavanya,
>
> On 5/14/24 09:12, lavanya tech wrote:
>
>> IMHO removing the port number is always the preferred solution — I never
>>> did it
>>>
>>>
>>>> can we achieve this with tomcat or we need to setup an reverse proxy
>>>> here.
>>>>
>>>>
>>> Your application uses whatever internal URLs it wants. Are you building
>>> those yourself, or are you asking Tomcat for the e.g. hostname, etc.? If
>>> it's Tomcat, this is where the proxyName and proxyPort come in.
>>>
>>
>>   - Yes, I have not built these UrLs before. It’s was working from the
>> very
>> beginning. As. I mentioned we are not able to reach goal or whatever.
>>
>> Rather than saying redirection, I would say it’s aliasing.
>>
>
> Please be specific. "Aliasing" (to me) means "the URL does to the right
> place but doesn't change in the browser's URL" and "redirection" (to
> everybody) means "HTTP 301 or 302 response to a new URL".
>
> Instead of moving applications or changing tomcat configuration it’s easier
>> to achieve with reverse proxy ?
>>
>> https://example.lbg.com/ to https://server.lbg.com:8443/towl
>>
>
> This will be a nightmare. Do not try to rewrite URLs using a reverse
> proxy. You should redirect users to the right place if necessary. You can
> use a reverse-proxy if you want, but it won't be any less complicated than
> having Tomcat do it.
>
> I think your rewrite.config file just needs a few tweaks:
>
> # Redirect everything that is not server.lbg.com to
> # server.lbg.com. Don't worry about /towl yet.
> RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
> RewriteRule ^/(.*) https://server.lbg.com:8443/$1 [R=301,L]
>
> # Redirect anything that isn't already going to /towl
> # to go to /towl
> RewriteCond %{REQUEST_URI} !^/towl
> RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 [R=301,L]
>
> The application should be deployed as towl.war (or towl/ directory). You
> should listen on ports 80, 443, and 8443, and you should always end up at
> the right place. You should have proxyPort="8443" and proxyName="
> server.lbg.com" in your .
>
> You will not need a ROOT context, since the rewrite will take care of that
> for you.
>
> -chris
>
> On Mon, May 13, 2024 at 10:17 PM lavanya tech 
>>> wrote:
>>>
>>> Hi Chris,
>>>
>>> Sorry, If I did confuse. It’s important that
>>> https://server.lbg.com:8443/towl is always working. Goal is not to
>>> disable /towl, but just redirect or aliasing
>>>
>>> https//example.lbg.com/ to https://server.lbg.com:8443/towl
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Lavanya
>>>
>>> On Monday, May 13, 2024, Christopher Schultz <
>>> ch...@christopherschultz.net
>>>
>>>>
>>>> wrote:
>>>
>>> Lavanya,
>>>
>>> On 5/13/24 05:57, lavanya tech wrote:
>>>
>>> Somehow made it work now i can only access urls as you mentioned before
>>> https://example.lbg.com and https://server.lbg.com with port 8443 and
>>> with
>>> out
>>>
>>> https://example.lbg.com/towl and https://server.lbg.com/towl --> I
>>> have an
>>> error now File not found.
>>>
>>> So i think we need to make work https://example.lbg.com/ to
>>> https://server.lbg.com/towl
>>>
>>>
>>> I'm sorry, I'm still confused as to which way you want things.
>>>
>>> Do you want to redirect /towl -> / or do you want to redirect / - >
>>> /towl?
>>>
>>> Or does it depend upon the hostname? It would really be better if you
>>> could settle on one specific beahvior.
>>>
>>> -chris
>>>
>>> On Mon, May 13, 2024 at 9:41 AM lavanya tech 
>>>
>>> wrote:
>>>
>>> Hi Chris,
>

Re: Regarding Tomcat url redirection

2024-05-14 Thread Christopher Schultz

Lavanya,

On 5/14/24 09:12, lavanya tech wrote:

IMHO removing the port number is always the preferred solution — I never
did it



can we achieve this with tomcat or we need to setup an reverse proxy here.



Your application uses whatever internal URLs it wants. Are you building
those yourself, or are you asking Tomcat for the e.g. hostname, etc.? If
it's Tomcat, this is where the proxyName and proxyPort come in.


  - Yes, I have not built these UrLs before. It’s was working from the very
beginning. As. I mentioned we are not able to reach goal or whatever.

Rather than saying redirection, I would say it’s aliasing.


Please be specific. "Aliasing" (to me) means "the URL does to the right 
place but doesn't change in the browser's URL" and "redirection" (to 
everybody) means "HTTP 301 or 302 response to a new URL".



Instead of moving applications or changing tomcat configuration it’s easier
to achieve with reverse proxy ?

https://example.lbg.com/ to https://server.lbg.com:8443/towl


This will be a nightmare. Do not try to rewrite URLs using a reverse 
proxy. You should redirect users to the right place if necessary. You 
can use a reverse-proxy if you want, but it won't be any less 
complicated than having Tomcat do it.


I think your rewrite.config file just needs a few tweaks:

# Redirect everything that is not server.lbg.com to
# server.lbg.com. Don't worry about /towl yet.
RewriteCond %{HTTP_HOST} !^server\.lbg\.com$
RewriteRule ^/(.*) https://server.lbg.com:8443/$1 [R=301,L]

# Redirect anything that isn't already going to /towl
# to go to /towl
RewriteCond %{REQUEST_URI} !^/towl
RewriteRule ^/(.*) https://server.lbg.com:8443/towl/$1 [R=301,L]

The application should be deployed as towl.war (or towl/ directory). You 
should listen on ports 80, 443, and 8443, and you should always end up 
at the right place. You should have proxyPort="8443" and 
proxyName="server.lbg.com" in your .


You will not need a ROOT context, since the rewrite will take care of 
that for you.


-chris


On Mon, May 13, 2024 at 10:17 PM lavanya tech 
wrote:

Hi Chris,

Sorry, If I did confuse. It’s important that
https://server.lbg.com:8443/towl is always working. Goal is not to
disable /towl, but just redirect or aliasing

https//example.lbg.com/ to https://server.lbg.com:8443/towl




Thanks,
Lavanya

On Monday, May 13, 2024, Christopher Schultz 


wrote:

Lavanya,

On 5/13/24 05:57, lavanya tech wrote:

Somehow made it work now i can only access urls as you mentioned before
https://example.lbg.com and https://server.lbg.com with port 8443 and
with
out

https://example.lbg.com/towl and https://server.lbg.com/towl --> I
have an
error now File not found.

So i think we need to make work https://example.lbg.com/ to
https://server.lbg.com/towl


I'm sorry, I'm still confused as to which way you want things.

Do you want to redirect /towl -> / or do you want to redirect / - > /towl?

Or does it depend upon the hostname? It would really be better if you
could settle on one specific beahvior.

-chris

On Mon, May 13, 2024 at 9:41 AM lavanya tech 

wrote:

Hi Chris,


Where are you defining the RewriteValve itself?

Defined rewritevalve here
 

 
resource="conf/rewrite.config" />

2) reated rewrite.config and added as below under conf/

RewriteCond %{REQUEST_URI} ^/towl/(.*)
RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
already have this mappings /* in web.xml file)

  
 
   Logging Area
   
   Authentication for registered users.
   
   /*
   /api/v1/search 
   /api/v1/suggest/* 
 
   
   LDAP_USER
   api
   
   

4) Restarted Tomcat, Then I cannot access
https://server.lbg.com:8443/towl
--> Have below error

Message java.nio.file.NoSuchFileException:
/git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar

Description The server encountered an unexpected condition that
prevented
it from fulfilling the request.

5) Also https://example.lbg.com doesnot work anymore

Before you do anything with redirecting, can you just make sure you are
only deploying ROOT.war and nothing else?
   How can I do that. I already changed towl.war to ROOT.war

But still both the urls have error as mentioned above.


Si I revereted back the changes.
That's weird. Try stopping, deleting the work/ directory and restarting.
--> I have this wierd behavior for some reason, thoudh index.jsp is
located
no changes were made to file. After deleting cookies url works

where Am I going wrong.

Thanks,
Lavanya


On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

Lavanya,


On 5/10/24 04:37, lavanya tech wrote:

I tried 

Re: Regarding Tomcat url redirection

2024-05-14 Thread lavanya tech
Hi Chris,

>
> IMHO removing the port number is always the preferred solution — I never
> did it
>
>>
>> can we achieve this with tomcat or we need to setup an reverse proxy here.
>>
>
> Your application uses whatever internal URLs it wants. Are you building
> those yourself, or are you asking Tomcat for the e.g. hostname, etc.? If
> it's Tomcat, this is where the proxyName and proxyPort come in.

 - Yes, I have not built these UrLs before. It’s was working from the very
beginning. As. I mentioned we are not able to reach goal or whatever.

Rather than saying redirection, I would say it’s aliasing.
Instead of moving applications or changing tomcat configuration it’s easier
to achieve with reverse proxy ?

https://example.lbg.com/ to https://server.lbg.com:8443/towl

Kindly let me know what’s the best way.

Thanks,
Ammu




>
> -chris
>
> On Mon, May 13, 2024 at 10:17 PM lavanya tech 
> wrote:
>
> Hi Chris,
>
> Sorry, If I did confuse. It’s important that
> https://server.lbg.com:8443/towl is always working. Goal is not to
> disable /towl, but just redirect or aliasing
>
> https//example.lbg.com/ to https://server.lbg.com:8443/towl
>
>
>
>
> Thanks,
> Lavanya
>
> On Monday, May 13, 2024, Christopher Schultz  >
> wrote:
>
> Lavanya,
>
> On 5/13/24 05:57, lavanya tech wrote:
>
> Somehow made it work now i can only access urls as you mentioned before
> https://example.lbg.com and https://server.lbg.com with port 8443 and
> with
> out
>
>https://example.lbg.com/towl and https://server.lbg.com/towl --> I
> have an
> error now File not found.
>
> So i think we need to make work https://example.lbg.com/ to
> https://server.lbg.com/towl
>
>
> I'm sorry, I'm still confused as to which way you want things.
>
> Do you want to redirect /towl -> / or do you want to redirect / - > /towl?
>
> Or does it depend upon the hostname? It would really be better if you
> could settle on one specific beahvior.
>
> -chris
>
> On Mon, May 13, 2024 at 9:41 AM lavanya tech 
>
> wrote:
>
> Hi Chris,
>
>
> Where are you defining the RewriteValve itself?
>
> Defined rewritevalve here
>unpackWARs="true" autoDeploy="true">
>
>  className="org.apache.catalina.valves.rewrite.RewriteValve" />
>resource="conf/rewrite.config" />
>
> 2) reated rewrite.config and added as below under conf/
>
>RewriteCond %{REQUEST_URI} ^/towl/(.*)
>RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>
> 3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
> already have this mappings /* in web.xml file)
>
>  
> 
>   Logging Area
>   
>   Authentication for registered users.
>   
>   /*
>   /api/v1/search 
>   /api/v1/suggest/* 
> 
>   
>   LDAP_USER
>   api
>   
>   
>
> 4) Restarted Tomcat, Then I cannot access
> https://server.lbg.com:8443/towl
> --> Have below error
>
> Message java.nio.file.NoSuchFileException:
> /git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar
>
> Description The server encountered an unexpected condition that
> prevented
> it from fulfilling the request.
>
> 5) Also https://example.lbg.com doesnot work anymore
>
> Before you do anything with redirecting, can you just make sure you are
> only deploying ROOT.war and nothing else?
>   How can I do that. I already changed towl.war to ROOT.war
>
> But still both the urls have error as mentioned above.
>
>
> Si I revereted back the changes.
> That's weird. Try stopping, deleting the work/ directory and restarting.
> --> I have this wierd behavior for some reason, thoudh index.jsp is
> located
> no changes were made to file. After deleting cookies url works
>
> where Am I going wrong.
>
> Thanks,
> Lavanya
>
>
> On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> Lavanya,
>
>
> On 5/10/24 04:37, lavanya tech wrote:
>
> I tried the below and have the issues.
>
> 1)proxyPort="443" and proxyName="example.lbg.com" to the connector
> 2) remanmed towl.war to ROOT.war
> 3) created rewrite.config and added as below under conf/
>
>
> Where are you defining the RewriteValve itself?
>
> RewriteCond %{REQUEST_URI} ^/towl/(.*)
>
> RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>
>
> If this is being handled by the ROOT servlet then I think it's right.
&

Re: Regarding Tomcat url redirection

2024-05-14 Thread Christopher Schultz

Lavanya,

On 5/14/24 03:47, lavanya tech wrote:

Hi Chris,

Tried the below steps. I have the redirection working. But the URL is not
in the browser anymore.

1)   
   

2) /conf/Catalina/localhost --> I added the below in rewrite.config

RewriteCond %{HTTP_HOST} ^example\.lbg\.com$
RewriteCond %{REQUEST_URI} !^/towl$
RewriteRule ^/(.*) https://server.lbg.com:8443/towl [R=301,L]


The problem with this is that it can redirect forever.

/towl/foo -> /towl/towl/foo -> /towl/towl/towl/foo and so on.

Your "stop criteria" ( !^/towl$ ) needs to be more like !^/towl/ without 
the $.



Then it redirects from https://example.lbg.com -->
https://server.lbg.com:8443/towl but the application team raised a concern
the

- alias https://example.lbg.com/--> url stays in the browser


IMHO removing the port number is always the preferred solution.

If https://example.lbg.com/ isn't returning a 301 response, then 
something is not quite right with your configuration.



- towl indexer uses the internal address https://
<https://denue-lp-build001.nbg.nokia.net/grok>server.lbg.com.8443/towl rsp.
localhost:8443/towl

can we achieve this with tomcat or we need to setup an reverse proxy here.


Your application uses whatever internal URLs it wants. Are you building 
those yourself, or are you asking Tomcat for the e.g. hostname, etc.? If 
it's Tomcat, this is where the proxyName and proxyPort come in.


-chris


On Mon, May 13, 2024 at 10:17 PM lavanya tech 
wrote:


Hi Chris,

Sorry, If I did confuse. It’s important that
https://server.lbg.com:8443/towl is always working. Goal is not to
disable /towl, but just redirect or aliasing

https//example.lbg.com/ to https://server.lbg.com:8443/towl




Thanks,
Lavanya

On Monday, May 13, 2024, Christopher Schultz 
wrote:


Lavanya,

On 5/13/24 05:57, lavanya tech wrote:


Somehow made it work now i can only access urls as you mentioned before
https://example.lbg.com and https://server.lbg.com with port 8443 and
with
out

   https://example.lbg.com/towl and https://server.lbg.com/towl --> I
have an
error now File not found.

So i think we need to make work https://example.lbg.com/ to
https://server.lbg.com/towl



I'm sorry, I'm still confused as to which way you want things.

Do you want to redirect /towl -> / or do you want to redirect / - > /towl?

Or does it depend upon the hostname? It would really be better if you
could settle on one specific beahvior.

-chris

On Mon, May 13, 2024 at 9:41 AM lavanya tech 

wrote:

Hi Chris,


Where are you defining the RewriteValve itself?

Defined rewritevalve here



   resource="conf/rewrite.config" />

2) reated rewrite.config and added as below under conf/

   RewriteCond %{REQUEST_URI} ^/towl/(.*)
   RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
already have this mappings /* in web.xml file)

 

  Logging Area
  
  Authentication for registered users.
  
  /*
  /api/v1/search 
  /api/v1/suggest/* 

  
  LDAP_USER
  api
  
  

4) Restarted Tomcat, Then I cannot access
https://server.lbg.com:8443/towl
--> Have below error

Message java.nio.file.NoSuchFileException:
/git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar

Description The server encountered an unexpected condition that
prevented
it from fulfilling the request.

5) Also https://example.lbg.com doesnot work anymore

Before you do anything with redirecting, can you just make sure you are
only deploying ROOT.war and nothing else?
  How can I do that. I already changed towl.war to ROOT.war

But still both the urls have error as mentioned above.


Si I revereted back the changes.
That's weird. Try stopping, deleting the work/ directory and restarting.
--> I have this wierd behavior for some reason, thoudh index.jsp is
located
no changes were made to file. After deleting cookies url works

where Am I going wrong.

Thanks,
Lavanya


On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

Lavanya,


On 5/10/24 04:37, lavanya tech wrote:


I tried the below and have the issues.

1)proxyPort="443" and proxyName="example.lbg.com" to the connector
2) remanmed towl.war to ROOT.war
3) created rewrite.config and added as below under conf/



Where are you defining the RewriteValve itself?

RewriteCond %{REQUEST_URI} ^/towl/(.*)

RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]



If this is being handled by the ROOT servlet then I think it's right.

4) added this in web.xml file of /webapps/towl/web.xml/


 
   

   
   
   
   Restricted Access to
/towl
   /towl/*



No, this is wrong. Since this is the "towl

Re: Regarding Tomcat url redirection

2024-05-14 Thread lavanya tech
Hi Chris,

Tried the below steps. I have the redirection working. But the URL is not
in the browser anymore.

1)   
  

2) /conf/Catalina/localhost --> I added the below in rewrite.config

RewriteCond %{HTTP_HOST} ^example\.lbg\.com$
RewriteCond %{REQUEST_URI} !^/towl$
RewriteRule ^/(.*) https://server.lbg.com:8443/towl [R=301,L]

Then it redirects from https://example.lbg.com -->
https://server.lbg.com:8443/towl but the application team raised a concern
the

   - alias https://example.lbg.com/--> url stays in the browser
   - towl indexer uses the internal address https://
   <https://denue-lp-build001.nbg.nokia.net/grok>server.lbg.com.8443/towl rsp.
   localhost:8443/towl

can we achieve this with tomcat or we need to setup an reverse proxy here.
Pleaes kindly suggest

Thanks,
Lavanya



On Mon, May 13, 2024 at 10:17 PM lavanya tech 
wrote:

> Hi Chris,
>
> Sorry, If I did confuse. It’s important that
> https://server.lbg.com:8443/towl is always working. Goal is not to
> disable /towl, but just redirect or aliasing
>
> https//example.lbg.com/ to https://server.lbg.com:8443/towl
>
>
>
>
> Thanks,
> Lavanya
>
> On Monday, May 13, 2024, Christopher Schultz 
> wrote:
>
>> Lavanya,
>>
>> On 5/13/24 05:57, lavanya tech wrote:
>>
>>> Somehow made it work now i can only access urls as you mentioned before
>>> https://example.lbg.com and https://server.lbg.com with port 8443 and
>>> with
>>> out
>>>
>>>   https://example.lbg.com/towl and https://server.lbg.com/towl --> I
>>> have an
>>> error now File not found.
>>>
>>> So i think we need to make work https://example.lbg.com/ to
>>> https://server.lbg.com/towl
>>>
>>
>> I'm sorry, I'm still confused as to which way you want things.
>>
>> Do you want to redirect /towl -> / or do you want to redirect / - > /towl?
>>
>> Or does it depend upon the hostname? It would really be better if you
>> could settle on one specific beahvior.
>>
>> -chris
>>
>> On Mon, May 13, 2024 at 9:41 AM lavanya tech 
>>> wrote:
>>>
>>> Hi Chris,
>>>>
>>>> Where are you defining the RewriteValve itself?
>>>>
>>>> Defined rewritevalve here
>>>>>>>  unpackWARs="true" autoDeploy="true">
>>>>
>>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve" />
>>>>   resource="conf/rewrite.config" />
>>>>
>>>> 2) reated rewrite.config and added as below under conf/
>>>>
>>>>   RewriteCond %{REQUEST_URI} ^/towl/(.*)
>>>>   RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>>>>
>>>> 3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
>>>> already have this mappings /* in web.xml file)
>>>>
>>>> 
>>>>
>>>>  Logging Area
>>>>  
>>>>  Authentication for registered users.
>>>>  
>>>>  /*
>>>>  /api/v1/search 
>>>>  /api/v1/suggest/* 
>>>>
>>>>  
>>>>  LDAP_USER
>>>>  api
>>>>  
>>>>  
>>>>
>>>> 4) Restarted Tomcat, Then I cannot access
>>>> https://server.lbg.com:8443/towl
>>>> --> Have below error
>>>>
>>>> Message java.nio.file.NoSuchFileException:
>>>> /git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar
>>>>
>>>> Description The server encountered an unexpected condition that
>>>> prevented
>>>> it from fulfilling the request.
>>>>
>>>> 5) Also https://example.lbg.com doesnot work anymore
>>>>
>>>> Before you do anything with redirecting, can you just make sure you are
>>>> only deploying ROOT.war and nothing else?
>>>>  How can I do that. I already changed towl.war to ROOT.war
>>>>
>>>> But still both the urls have error as mentioned above.
>>>>
>>>>
>>>> Si I revereted back the changes.
>>>> That's weird. Try stopping, deleting the work/ directory and restarting.
>>>> --> I have this wierd behavior for some reason, thoudh index.jsp is
>>>> located
>>>> no changes were made to file. After deleting cookies

Re: Regarding Tomcat url redirection

2024-05-13 Thread lavanya tech
Hi Chris,

Sorry, If I did confuse. It’s important that
https://server.lbg.com:8443/towl is always working. Goal is not to disable
/towl, but just redirect or aliasing

https//example.lbg.com/ to https://server.lbg.com:8443/towl




Thanks,
Lavanya

On Monday, May 13, 2024, Christopher Schultz 
wrote:

> Lavanya,
>
> On 5/13/24 05:57, lavanya tech wrote:
>
>> Somehow made it work now i can only access urls as you mentioned before
>> https://example.lbg.com and https://server.lbg.com with port 8443 and
>> with
>> out
>>
>>   https://example.lbg.com/towl and https://server.lbg.com/towl --> I
>> have an
>> error now File not found.
>>
>> So i think we need to make work https://example.lbg.com/ to
>> https://server.lbg.com/towl
>>
>
> I'm sorry, I'm still confused as to which way you want things.
>
> Do you want to redirect /towl -> / or do you want to redirect / - > /towl?
>
> Or does it depend upon the hostname? It would really be better if you
> could settle on one specific beahvior.
>
> -chris
>
> On Mon, May 13, 2024 at 9:41 AM lavanya tech 
>> wrote:
>>
>> Hi Chris,
>>>
>>> Where are you defining the RewriteValve itself?
>>>
>>> Defined rewritevalve here
>>>>>  unpackWARs="true" autoDeploy="true">
>>>
>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve" />
>>>   resource="conf/rewrite.config" />
>>>
>>> 2) reated rewrite.config and added as below under conf/
>>>
>>>   RewriteCond %{REQUEST_URI} ^/towl/(.*)
>>>   RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>>>
>>> 3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
>>> already have this mappings /* in web.xml file)
>>>
>>> 
>>>
>>>  Logging Area
>>>  
>>>  Authentication for registered users.
>>>  
>>>  /*
>>>  /api/v1/search 
>>>  /api/v1/suggest/* 
>>>
>>>  
>>>  LDAP_USER
>>>  api
>>>  
>>>  
>>>
>>> 4) Restarted Tomcat, Then I cannot access https://server.lbg.com:8443/to
>>> wl
>>> --> Have below error
>>>
>>> Message java.nio.file.NoSuchFileException:
>>> /git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar
>>>
>>> Description The server encountered an unexpected condition that prevented
>>> it from fulfilling the request.
>>>
>>> 5) Also https://example.lbg.com doesnot work anymore
>>>
>>> Before you do anything with redirecting, can you just make sure you are
>>> only deploying ROOT.war and nothing else?
>>>  How can I do that. I already changed towl.war to ROOT.war
>>>
>>> But still both the urls have error as mentioned above.
>>>
>>>
>>> Si I revereted back the changes.
>>> That's weird. Try stopping, deleting the work/ directory and restarting.
>>> --> I have this wierd behavior for some reason, thoudh index.jsp is
>>> located
>>> no changes were made to file. After deleting cookies url works
>>>
>>> where Am I going wrong.
>>>
>>> Thanks,
>>> Lavanya
>>>
>>>
>>> On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
>>> ch...@christopherschultz.net> wrote:
>>>
>>> Lavanya,

 On 5/10/24 04:37, lavanya tech wrote:

> I tried the below and have the issues.
>
> 1)proxyPort="443" and proxyName="example.lbg.com" to the connector
> 2) remanmed towl.war to ROOT.war
> 3) created rewrite.config and added as below under conf/
>

 Where are you defining the RewriteValve itself?

 RewriteCond %{REQUEST_URI} ^/towl/(.*)
> RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>

 If this is being handled by the ROOT servlet then I think it's right.

 4) added this in web.xml file of /webapps/towl/web.xml/
>
> 
>   
>
>   
>   
>   
>   Restricted Access to
> /towl
>   /towl/*
>

 No, this is wrong. Since this is the "towl" application and not ROOT,
 you want to map /* and not /towl/* because the application will never
 see the /towl/ as it's an application/context prefix that Tomcat will
 remove.

   
>   
>   
>   
>   
>
> Also I noticed that even if I rename the towl application to ROOT, when
>
 i

> call the url with https://example.lbg.com/towl --> this towl directory
>
 is

> getting created under webapps by default
>

 If webapps/towl is being created, then it's happening for some other
 reason. Do you have anything under conf/Catalina/*/towl.xml which points
 to a WAR file or something? If so, remove that.

 5) Resarted tomcat and I have the below error and all the urls have the
> same issue
>
> Message org.apache.jasper.JasperException:
> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>

 That's weird. Try stopping, deleting the work/ directory and restarting.

 Descri

Re: Regarding Tomcat url redirection

2024-05-13 Thread Christopher Schultz

Lavanya,

On 5/13/24 05:57, lavanya tech wrote:

Somehow made it work now i can only access urls as you mentioned before
https://example.lbg.com and https://server.lbg.com with port 8443 and with
out

  https://example.lbg.com/towl and https://server.lbg.com/towl --> I have an
error now File not found.

So i think we need to make work https://example.lbg.com/ to
https://server.lbg.com/towl


I'm sorry, I'm still confused as to which way you want things.

Do you want to redirect /towl -> / or do you want to redirect / - > /towl?

Or does it depend upon the hostname? It would really be better if you 
could settle on one specific beahvior.


-chris


On Mon, May 13, 2024 at 9:41 AM lavanya tech 
wrote:


Hi Chris,

Where are you defining the RewriteValve itself?

Defined rewritevalve here
   

   
  resource="conf/rewrite.config" />

2) reated rewrite.config and added as below under conf/

  RewriteCond %{REQUEST_URI} ^/towl/(.*)
  RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
already have this mappings /* in web.xml file)


   
 Logging Area
 
 Authentication for registered users.
 
 /*
 /api/v1/search 
 /api/v1/suggest/* 
   
 
 LDAP_USER
 api
 
 

4) Restarted Tomcat, Then I cannot access https://server.lbg.com:8443/towl
--> Have below error

Message java.nio.file.NoSuchFileException:
/git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

5) Also https://example.lbg.com doesnot work anymore

Before you do anything with redirecting, can you just make sure you are
only deploying ROOT.war and nothing else?
 How can I do that. I already changed towl.war to ROOT.war

But still both the urls have error as mentioned above.


Si I revereted back the changes.
That's weird. Try stopping, deleting the work/ directory and restarting.
--> I have this wierd behavior for some reason, thoudh index.jsp is located
no changes were made to file. After deleting cookies url works

where Am I going wrong.

Thanks,
Lavanya


On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Lavanya,

On 5/10/24 04:37, lavanya tech wrote:

I tried the below and have the issues.

1)proxyPort="443" and proxyName="example.lbg.com" to the connector
2) remanmed towl.war to ROOT.war
3) created rewrite.config and added as below under conf/


Where are you defining the RewriteValve itself?


RewriteCond %{REQUEST_URI} ^/towl/(.*)
RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]


If this is being handled by the ROOT servlet then I think it's right.


4) added this in web.xml file of /webapps/towl/web.xml/


  

  
  
  
  Restricted Access to
/towl
  /towl/*


No, this is wrong. Since this is the "towl" application and not ROOT,
you want to map /* and not /towl/* because the application will never
see the /towl/ as it's an application/context prefix that Tomcat will
remove.


  
  
  
  
  

Also I noticed that even if I rename the towl application to ROOT, when

i

call the url with https://example.lbg.com/towl --> this towl directory

is

getting created under webapps by default


If webapps/towl is being created, then it's happening for some other
reason. Do you have anything under conf/Catalina/*/towl.xml which points
to a WAR file or something? If so, remove that.


5) Resarted tomcat and I have the below error and all the urls have the
same issue

Message org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp


That's weird. Try stopping, deleting the work/ directory and restarting.


Description The server encountered an unexpected condition that

prevented

it from fulfilling the request.

Exception

org.apache.jasper.JasperException: org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)



org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


Before you do anything with redirecting, can you just make sure you are
only deploying ROOT.war and nothing else?

This should allow you to reach the application at both
https://example.lbg.com/ and https://server.lbg.com/ as well as both of
those with port 8443.

Then use the applications and make sure they are working as expected.
Then, we'll add the /towl handling.

-chr

Re: Regarding Tomcat url redirection

2024-05-13 Thread lavanya tech
Hi Chris,

Somehow made it work now i can only access urls as you mentioned before
https://example.lbg.com and https://server.lbg.com with port 8443 and with
out

 https://example.lbg.com/towl and https://server.lbg.com/towl --> I have an
error now File not found.

So i think we need to make work https://example.lbg.com/ to
https://server.lbg.com/towl

Thanks,
Lavanya


On Mon, May 13, 2024 at 9:41 AM lavanya tech 
wrote:

> Hi Chris,
>
> Where are you defining the RewriteValve itself?
>
> Defined rewritevalve here
>unpackWARs="true" autoDeploy="true">
>
>className="org.apache.catalina.valves.rewrite.RewriteValve" />
>  resource="conf/rewrite.config" />
>
> 2) reated rewrite.config and added as below under conf/
>
>  RewriteCond %{REQUEST_URI} ^/towl/(.*)
>  RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>
> 3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I
> already have this mappings /* in web.xml file)
>
>
>   
> Logging Area
> 
> Authentication for registered users.
> 
> /*
> /api/v1/search 
> /api/v1/suggest/* 
>   
> 
> LDAP_USER
> api
> 
> 
>
> 4) Restarted Tomcat, Then I cannot access https://server.lbg.com:8443/towl
> --> Have below error
>
> Message java.nio.file.NoSuchFileException:
> /git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar
>
> Description The server encountered an unexpected condition that prevented
> it from fulfilling the request.
>
> 5) Also https://example.lbg.com doesnot work anymore
>
> Before you do anything with redirecting, can you just make sure you are
> only deploying ROOT.war and nothing else?
> How can I do that. I already changed towl.war to ROOT.war
>
> But still both the urls have error as mentioned above.
>
>
> Si I revereted back the changes.
> That's weird. Try stopping, deleting the work/ directory and restarting.
> --> I have this wierd behavior for some reason, thoudh index.jsp is located
> no changes were made to file. After deleting cookies url works
>
> where Am I going wrong.
>
> Thanks,
> Lavanya
>
>
> On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> Lavanya,
>>
>> On 5/10/24 04:37, lavanya tech wrote:
>> > I tried the below and have the issues.
>> >
>> > 1)proxyPort="443" and proxyName="example.lbg.com" to the connector
>> > 2) remanmed towl.war to ROOT.war
>> > 3) created rewrite.config and added as below under conf/
>>
>> Where are you defining the RewriteValve itself?
>>
>> > RewriteCond %{REQUEST_URI} ^/towl/(.*)
>> > RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>>
>> If this is being handled by the ROOT servlet then I think it's right.
>>
>> > 4) added this in web.xml file of /webapps/towl/web.xml/
>> >
>> >
>> >  
>> >
>> >  
>> >  
>> >  
>> >  Restricted Access to
>> > /towl
>> >  /towl/*
>>
>> No, this is wrong. Since this is the "towl" application and not ROOT,
>> you want to map /* and not /towl/* because the application will never
>> see the /towl/ as it's an application/context prefix that Tomcat will
>> remove.
>>
>> >  
>> >  
>> >  
>> >  
>> >  
>> >
>> > Also I noticed that even if I rename the towl application to ROOT, when
>> i
>> > call the url with https://example.lbg.com/towl --> this towl directory
>> is
>> > getting created under webapps by default
>>
>> If webapps/towl is being created, then it's happening for some other
>> reason. Do you have anything under conf/Catalina/*/towl.xml which points
>> to a WAR file or something? If so, remove that.
>>
>> > 5) Resarted tomcat and I have the below error and all the urls have the
>> > same issue
>> >
>> > Message org.apache.jasper.JasperException:
>> > java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>>
>> That's weird. Try stopping, deleting the work/ directory and restarting.
>>
>> > Description The server encountered an unexpected condition that
>> prevented
>> > it from fulfilling the request.
>> >
>> > Exception
>> >
>> > org.apache.jasper.JasperException: org.apache.jasper.JasperException:
>> > java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>> >
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)
>> >
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
>> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
>> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
>> > jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
>> > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
>>
>> Before you do anything with redirecting, can you just make sure you are
>> only deploying ROOT.war and nothing else?
>>
>> This should allow you to reach the application at both
>> https://example.lb

Re: Regarding Tomcat url redirection

2024-05-13 Thread lavanya tech
Hi Chris,

Where are you defining the RewriteValve itself?

Defined rewritevalve here
  

  
 resource="conf/rewrite.config" />

2) reated rewrite.config and added as below under conf/

 RewriteCond %{REQUEST_URI} ^/towl/(.*)
 RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

3) After renaming towl to ROOT -> /webapps/ROOT/WEB-INF/web.xml ( I already
have this mappings /* in web.xml file)

   
  
Logging Area

Authentication for registered users.

/*
/api/v1/search 
/api/v1/suggest/* 
  

LDAP_USER
api



4) Restarted Tomcat, Then I cannot access https://server.lbg.com:8443/towl
--> Have below error

Message java.nio.file.NoSuchFileException:
/git/apache-tomcat-10.1.11/webapps/towl/WEB-INF/lib/xss-1.0.8.jar

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

5) Also https://example.lbg.com doesnot work anymore

Before you do anything with redirecting, can you just make sure you are
only deploying ROOT.war and nothing else?
How can I do that. I already changed towl.war to ROOT.war

But still both the urls have error as mentioned above.


Si I revereted back the changes.
That's weird. Try stopping, deleting the work/ directory and restarting.
--> I have this wierd behavior for some reason, thoudh index.jsp is located
no changes were made to file. After deleting cookies url works

where Am I going wrong.

Thanks,
Lavanya


On Fri, May 10, 2024 at 6:50 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Lavanya,
>
> On 5/10/24 04:37, lavanya tech wrote:
> > I tried the below and have the issues.
> >
> > 1)proxyPort="443" and proxyName="example.lbg.com" to the connector
> > 2) remanmed towl.war to ROOT.war
> > 3) created rewrite.config and added as below under conf/
>
> Where are you defining the RewriteValve itself?
>
> > RewriteCond %{REQUEST_URI} ^/towl/(.*)
> > RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>
> If this is being handled by the ROOT servlet then I think it's right.
>
> > 4) added this in web.xml file of /webapps/towl/web.xml/
> >
> >
> >  
> >
> >  
> >  
> >  
> >  Restricted Access to
> > /towl
> >  /towl/*
>
> No, this is wrong. Since this is the "towl" application and not ROOT,
> you want to map /* and not /towl/* because the application will never
> see the /towl/ as it's an application/context prefix that Tomcat will
> remove.
>
> >  
> >  
> >  
> >  
> >  
> >
> > Also I noticed that even if I rename the towl application to ROOT, when i
> > call the url with https://example.lbg.com/towl --> this towl directory
> is
> > getting created under webapps by default
>
> If webapps/towl is being created, then it's happening for some other
> reason. Do you have anything under conf/Catalina/*/towl.xml which points
> to a WAR file or something? If so, remove that.
>
> > 5) Resarted tomcat and I have the below error and all the urls have the
> > same issue
> >
> > Message org.apache.jasper.JasperException:
> > java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>
> That's weird. Try stopping, deleting the work/ directory and restarting.
>
> > Description The server encountered an unexpected condition that prevented
> > it from fulfilling the request.
> >
> > Exception
> >
> > org.apache.jasper.JasperException: org.apache.jasper.JasperException:
> > java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
> >
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
> > jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
> > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
>
> Before you do anything with redirecting, can you just make sure you are
> only deploying ROOT.war and nothing else?
>
> This should allow you to reach the application at both
> https://example.lbg.com/ and https://server.lbg.com/ as well as both of
> those with port 8443.
>
> Then use the applications and make sure they are working as expected.
> Then, we'll add the /towl handling.
>
> -chris
>
> > On Thu, May 9, 2024 at 11:20 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Lavanya,
> >>
> >> On 5/9/24 13:48, lavanya tech wrote:
> >>> Thank you so much for your explanation. I will try these options.
> >>>
> >>> Do server and example both resolve to the same IP?
> >>>   -yes
> >>
> >> Good, that significantly reduces the complexity required, since you can
> >> do it will a single process (Tomcat) in a single environment.
> >>
> >>> So I need follow both 4a/b and 5a/b steps here or a

Re: Regarding Tomcat url redirection

2024-05-10 Thread Christopher Schultz

Lavanya,

On 5/10/24 06:03, lavanya tech wrote:

If we create new java.filter as below then we can redirect the urls  ?

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter("/*")
public class UrlRedirectionFilter implements Filter {

 @Override
 public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
 throws IOException, ServletException {
 HttpServletRequest httpRequest = (HttpServletRequest) request;
 HttpServletResponse httpResponse = (HttpServletResponse) response;

 String requestUrl = httpRequest.getRequestURL().toString();

 // Check if the request URL matches the target URL
 if (requestUrl.equals("https://example.lbg.com";)) {
 // Perform redirect to the desired destination URL
 httpResponse.sendRedirect("https://server.lbg.com/towl";);



This is the exact opposite of the stated goal.

You said you wanted server.lbg.com/towl to be redirected to 
example.lbg.com/ but this does the opposite.


I also wouldn't both to check the protocol. Let's save this until after 
the ROOT application is working as expected.


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-05-10 Thread Christopher Schultz

Lavanya,

On 5/10/24 04:37, lavanya tech wrote:

I tried the below and have the issues.

1)proxyPort="443" and proxyName="example.lbg.com" to the connector
2) remanmed towl.war to ROOT.war
3) created rewrite.config and added as below under conf/


Where are you defining the RewriteValve itself?


RewriteCond %{REQUEST_URI} ^/towl/(.*)
RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]


If this is being handled by the ROOT servlet then I think it's right.


4) added this in web.xml file of /webapps/towl/web.xml/

   
 

 
 
 
 Restricted Access to
/towl
 /towl/*


No, this is wrong. Since this is the "towl" application and not ROOT, 
you want to map /* and not /towl/* because the application will never 
see the /towl/ as it's an application/context prefix that Tomcat will 
remove.



 
 
 
 
 

Also I noticed that even if I rename the towl application to ROOT, when i
call the url with https://example.lbg.com/towl --> this towl directory is
getting created under webapps by default


If webapps/towl is being created, then it's happening for some other 
reason. Do you have anything under conf/Catalina/*/towl.xml which points 
to a WAR file or something? If so, remove that.



5) Resarted tomcat and I have the below error and all the urls have the
same issue

Message org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp


That's weird. Try stopping, deleting the work/ directory and restarting.


Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception

org.apache.jasper.JasperException: org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


Before you do anything with redirecting, can you just make sure you are 
only deploying ROOT.war and nothing else?


This should allow you to reach the application at both 
https://example.lbg.com/ and https://server.lbg.com/ as well as both of 
those with port 8443.


Then use the applications and make sure they are working as expected. 
Then, we'll add the /towl handling.


-chris


On Thu, May 9, 2024 at 11:20 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Lavanya,

On 5/9/24 13:48, lavanya tech wrote:

Thank you so much for your explanation. I will try these options.

Do server and example both resolve to the same IP?
  -yes


Good, that significantly reduces the complexity required, since you can
do it will a single process (Tomcat) in a single environment.


So I need follow both 4a/b and 5a/b steps here or any of them ?

If I setup exactly by using below steps , then I should access both the
urls right ? https://server.lbg.com:8443/towl and

https://example.lbg.com

If you visit either hostname with /towl, you will be redirected to
example.lbg.com/ with no port number. example:8443 will still work and
no redirect will take place... unless you specifically make arrangements
for that. We can do that later if you really want to.

Let's get the other things working, first.

-chris


On Thursday, May 9, 2024, Christopher Schultz <

ch...@christopherschultz.net>

wrote:


Lavanya,

On 5/9/24 02:58, lavanya tech wrote:


Just giving background again of this topic again.

1) The application team who is working they wanted to access the url
https://server.lbg.com:8443/towl —> which should redirect or point to
https://example.lbg.com

Is that a typo? You want specifically https://server.lbg.com/towl and
https://example.lbg.com/ to point to your application?
 — It’s not the Typo the requirements are still the

same.




Okay.

Do server and example both resolve to the same IP?

2) Hence I added firewall rule to redirect port 443 to 8443. And the url

https://example.lbg.com started working but its pointing to
https://server.lbg.com:8443 indeed and not

https://server.lbg.com:8443/to

wl

But then they wanted the point 1 to have it. If I understood

correctly. So

basically to achieve this we wanted a reverse proxy setup ?

I didnot define any additional host in server.xml file on just left to
default to  local host.



Here's what you have to do in order to support this odd configuration.

1. Configure your firewall to route port 443 -> 8443. I suspect this is
already done.

2. Deploy Tomcat on server.lbg.com with a  on port 8443.

This

is the default, so there shouldn't be anything to do. I suspect this is
already done. You should set proxyPort="443" and proxyName="
example.

Re: Regarding Tomcat url redirection

2024-05-10 Thread lavanya tech
Hi Chris,
If we create new java.filter as below then we can redirect the urls  ?

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter("/*")
public class UrlRedirectionFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;

String requestUrl = httpRequest.getRequestURL().toString();

// Check if the request URL matches the target URL
if (requestUrl.equals("https://example.lbg.com";)) {
// Perform redirect to the desired destination URL
httpResponse.sendRedirect("https://server.lbg.com/towl";);
return;
}

// For all other URLs, disable access
httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
}

// Other methods of the Filter interface (init(), destroy()) can be
left empty for this example
}

Thanks,
Lavanya

On Fri, May 10, 2024 at 10:37 AM lavanya tech 
wrote:

> Hi Chris,
>
> I tried the below and have the issues.
>
> 1)proxyPort="443" and proxyName="example.lbg.com" to the connector
> 2) remanmed towl.war to ROOT.war
> 3) created rewrite.config and added as below under conf/
>
> RewriteCond %{REQUEST_URI} ^/towl/(.*)
> RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]
>
> 4) added this in web.xml file of /webapps/towl/web.xml/
>
>   
> 
>
> 
> 
> 
> Restricted Access to
> /towl
> /towl/*
> 
> 
> 
> 
> 
>
> Also I noticed that even if I rename the towl application to ROOT, when i
> call the url with https://example.lbg.com/towl --> this towl directory is
> getting created under webapps by default
>
> 5) Resarted tomcat and I have the below error and all the urls have the
> same issue
>
> Message org.apache.jasper.JasperException:
> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>
> Description The server encountered an unexpected condition that prevented
> it from fulfilling the request.
>
> Exception
>
> org.apache.jasper.JasperException: org.apache.jasper.JasperException:
> java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
> jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
>
> On Thu, May 9, 2024 at 11:20 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
>> Lavanya,
>>
>> On 5/9/24 13:48, lavanya tech wrote:
>> > Thank you so much for your explanation. I will try these options.
>> >
>> > Do server and example both resolve to the same IP?
>> >  -yes
>>
>> Good, that significantly reduces the complexity required, since you can
>> do it will a single process (Tomcat) in a single environment.
>>
>> > So I need follow both 4a/b and 5a/b steps here or any of them ?
>> >
>> > If I setup exactly by using below steps , then I should access both the
>> > urls right ? https://server.lbg.com:8443/towl and
>> https://example.lbg.com
>>
>> If you visit either hostname with /towl, you will be redirected to
>> example.lbg.com/ with no port number. example:8443 will still work and
>> no redirect will take place... unless you specifically make arrangements
>> for that. We can do that later if you really want to.
>>
>> Let's get the other things working, first.
>>
>> -chris
>>
>> > On Thursday, May 9, 2024, Christopher Schultz <
>> ch...@christopherschultz.net>
>> > wrote:
>> >
>> >> Lavanya,
>> >>
>> >> On 5/9/24 02:58, lavanya tech wrote:
>> >>
>> >>> Just giving background again of this topic again.
>> >>>
>> >>> 1) The application team who is working they wanted to access the url
>> >>> https://server.lbg.com:8443/towl —> which should redirect or point to
>> >>> https://example.lbg.com
>> >>>
>> >>> Is that a typo? You want specifically https://server.lbg.com/towl and
>> >>> https://example.lbg.com/ to point to your application?
>> >>> — It’s not the Typo the requirements are still the
>> same.
>> >>>
>> >>
>> >> Okay.
>> >>
>> >> Do server and example both resolve to the same IP?
>> >>
>> >> 2) Hence I added firewall rule to redirect port 443 to 8443. And the
>> url
>> >>> https://example.lbg.com started working but its pointing to
>> >>> https://server.lbg.com:8443 indeed and not
>> https://server.lbg.com:8443/to
>> >>> wl
>> >>>
>> >>> But then they wa

Re: Regarding Tomcat url redirection

2024-05-10 Thread lavanya tech
Hi Chris,

I tried the below and have the issues.

1)proxyPort="443" and proxyName="example.lbg.com" to the connector
2) remanmed towl.war to ROOT.war
3) created rewrite.config and added as below under conf/

RewriteCond %{REQUEST_URI} ^/towl/(.*)
RewriteRule ^/towl/(.*) https://example.lbg.com/%1 [R]

4) added this in web.xml file of /webapps/towl/web.xml/

  





Restricted Access to
/towl
/towl/*






Also I noticed that even if I rename the towl application to ROOT, when i
call the url with https://example.lbg.com/towl --> this towl directory is
getting created under webapps by default

5) Resarted tomcat and I have the below error and all the urls have the
same issue

Message org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp

Description The server encountered an unexpected condition that prevented
it from fulfilling the request.

Exception

org.apache.jasper.JasperException: org.apache.jasper.JasperException:
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:578)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:422)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

On Thu, May 9, 2024 at 11:20 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Lavanya,
>
> On 5/9/24 13:48, lavanya tech wrote:
> > Thank you so much for your explanation. I will try these options.
> >
> > Do server and example both resolve to the same IP?
> >  -yes
>
> Good, that significantly reduces the complexity required, since you can
> do it will a single process (Tomcat) in a single environment.
>
> > So I need follow both 4a/b and 5a/b steps here or any of them ?
> >
> > If I setup exactly by using below steps , then I should access both the
> > urls right ? https://server.lbg.com:8443/towl and
> https://example.lbg.com
>
> If you visit either hostname with /towl, you will be redirected to
> example.lbg.com/ with no port number. example:8443 will still work and
> no redirect will take place... unless you specifically make arrangements
> for that. We can do that later if you really want to.
>
> Let's get the other things working, first.
>
> -chris
>
> > On Thursday, May 9, 2024, Christopher Schultz <
> ch...@christopherschultz.net>
> > wrote:
> >
> >> Lavanya,
> >>
> >> On 5/9/24 02:58, lavanya tech wrote:
> >>
> >>> Just giving background again of this topic again.
> >>>
> >>> 1) The application team who is working they wanted to access the url
> >>> https://server.lbg.com:8443/towl —> which should redirect or point to
> >>> https://example.lbg.com
> >>>
> >>> Is that a typo? You want specifically https://server.lbg.com/towl and
> >>> https://example.lbg.com/ to point to your application?
> >>> — It’s not the Typo the requirements are still the
> same.
> >>>
> >>
> >> Okay.
> >>
> >> Do server and example both resolve to the same IP?
> >>
> >> 2) Hence I added firewall rule to redirect port 443 to 8443. And the url
> >>> https://example.lbg.com started working but its pointing to
> >>> https://server.lbg.com:8443 indeed and not
> https://server.lbg.com:8443/to
> >>> wl
> >>>
> >>> But then they wanted the point 1 to have it. If I understood
> correctly. So
> >>> basically to achieve this we wanted a reverse proxy setup ?
> >>>
> >>> I didnot define any additional host in server.xml file on just left to
> >>> default to  local host.
> >>>
> >>
> >> Here's what you have to do in order to support this odd configuration.
> >>
> >> 1. Configure your firewall to route port 443 -> 8443. I suspect this is
> >> already done.
> >>
> >> 2. Deploy Tomcat on server.lbg.com with a  on port 8443.
> This
> >> is the default, so there shouldn't be anything to do. I suspect this is
> >> already done. You should set proxyPort="443" and proxyName="
> >> example.lbg.com" in your . This will ensure that any URLs
> >> generated by Tomcat or your application will point to
> >> https://example.lbg.com/ and not to server.lbg.com or have a port
> number
> >> or whatever.
> >>
> >> 3. Re-name your application directory or WAR file from towl -> ROOT
> (upper
> >> case is important). So if you have tomcat/webapps/towl re-name that to
> >> tomcat/webapps/ROOT or if you have tomcat/webapps/towl.war re-name that
> to
> >> tomcat/webapps/ROOT.war.
> >>
> >> The last thing to do is get /towl to re-direct to /. There are a few
> ways
> >> of doing that.
> >>
> >> 4a. Configure your application (now called ROOT and deployed on / and
> not
> >> /towl anymore) to handle the /towl URL and specifically redirect this
> back
> >> to /. This is oddly specific and has t

Re: Regarding Tomcat url redirection

2024-05-09 Thread Christopher Schultz

Lavanya,

On 5/9/24 13:48, lavanya tech wrote:

Thank you so much for your explanation. I will try these options.

Do server and example both resolve to the same IP?
 -yes


Good, that significantly reduces the complexity required, since you can 
do it will a single process (Tomcat) in a single environment.



So I need follow both 4a/b and 5a/b steps here or any of them ?

If I setup exactly by using below steps , then I should access both the
urls right ? https://server.lbg.com:8443/towl and https://example.lbg.com


If you visit either hostname with /towl, you will be redirected to 
example.lbg.com/ with no port number. example:8443 will still work and 
no redirect will take place... unless you specifically make arrangements 
for that. We can do that later if you really want to.


Let's get the other things working, first.

-chris


On Thursday, May 9, 2024, Christopher Schultz 
wrote:


Lavanya,

On 5/9/24 02:58, lavanya tech wrote:


Just giving background again of this topic again.

1) The application team who is working they wanted to access the url
https://server.lbg.com:8443/towl —> which should redirect or point to
https://example.lbg.com

Is that a typo? You want specifically https://server.lbg.com/towl and
https://example.lbg.com/ to point to your application?
— It’s not the Typo the requirements are still the same.



Okay.

Do server and example both resolve to the same IP?

2) Hence I added firewall rule to redirect port 443 to 8443. And the url

https://example.lbg.com started working but its pointing to
https://server.lbg.com:8443 indeed and not https://server.lbg.com:8443/to
wl

But then they wanted the point 1 to have it. If I understood correctly. So
basically to achieve this we wanted a reverse proxy setup ?

I didnot define any additional host in server.xml file on just left to
default to  local host.



Here's what you have to do in order to support this odd configuration.

1. Configure your firewall to route port 443 -> 8443. I suspect this is
already done.

2. Deploy Tomcat on server.lbg.com with a  on port 8443. This
is the default, so there shouldn't be anything to do. I suspect this is
already done. You should set proxyPort="443" and proxyName="
example.lbg.com" in your . This will ensure that any URLs
generated by Tomcat or your application will point to
https://example.lbg.com/ and not to server.lbg.com or have a port number
or whatever.

3. Re-name your application directory or WAR file from towl -> ROOT (upper
case is important). So if you have tomcat/webapps/towl re-name that to
tomcat/webapps/ROOT or if you have tomcat/webapps/towl.war re-name that to
tomcat/webapps/ROOT.war.

The last thing to do is get /towl to re-direct to /. There are a few ways
of doing that.

4a. Configure your application (now called ROOT and deployed on / and not
/towl anymore) to handle the /towl URL and specifically redirect this back
to /. This is oddly specific and has the application trying to redirect to
itself which is weird.

4b. Create a new application called towl or towl.war which will be
deployed on /towl and have THAT redirect to /. I think this is cleaner
because you can call the application anything you'd like and it will still
work. You don't have to match URL patterns yourself, you just re-name the
WAR file if you suddenly want to use /towl2 instead of /towl.

There are several ways to redirect.

5a. Use the rewrite valve and map /(*) to (global redirect) /\1. A few
notes: (1) the (*) means "capture this string" and \1 means "put the string
back. This allows you to redirect /towl/foo/bar to /foo/bar instead of
losing the /foo/bar. This syntax may not be perfect, adapt it to your
needs. (2) Remember that the towl application is deployed on /towl so you
don't want to redirect /towl/foo/bar you only want redirect /foo/bar since
the URL will be relative to the current context (/towl). Got that? Finally,
(3) you need to use a global redirect that does *NOT* redirect back to the
/towl application. Normally, if you redirect to /foo you'll get an
application-relative redirect from something like a rewrite
valve/filter/whatever. Take care to redirect relative to the SERVER and not
to the application.

5b. Write your own servlet to do a specific redirect.

I hope that helps,
-chris

On Wednesday, May 8, 2024, Christopher Schultz <

ch...@christopherschultz.net>
wrote:

Lavanya,


On 5/8/24 06:48, lavanya tech wrote:

I figured out how I can it make it work with 443. Now the URls are

working.
I added iptables route 443 to 8443 and it started working.

nslookup example.lbg.com

Non-authoritative answer:
Name:server.lbg.com
Address:  192.168.200.105
Aliases:  example.lbg.com


I have some application towl running with apache tomcat. I have the
below
URLs working.

https://server.lbg.com:8443/towl
https://server.lbg.com
https://example.lbg.com
https://example.lbg.com/towl


Now i wanted to disable the url https://example.lbg.com/towl and
https://server.lbg.com and a

Re: Regarding Tomcat url redirection

2024-05-09 Thread lavanya tech
Hi Chris,

Thank you so much for your explanation. I will try these options.

Do server and example both resolve to the same IP?
-yes

So I need follow both 4a/b and 5a/b steps here or any of them ?

If I setup exactly by using below steps , then I should access both the
urls right ? https://server.lbg.com:8443/towl and https://example.lbg.com

I will configure and if I face any issues I will write to you.

Thanks,
Lavanya


On Thursday, May 9, 2024, Christopher Schultz 
wrote:

> Lavanya,
>
> On 5/9/24 02:58, lavanya tech wrote:
>
>> Just giving background again of this topic again.
>>
>> 1) The application team who is working they wanted to access the url
>> https://server.lbg.com:8443/towl —> which should redirect or point to
>> https://example.lbg.com
>>
>> Is that a typo? You want specifically https://server.lbg.com/towl and
>> https://example.lbg.com/ to point to your application?
>>— It’s not the Typo the requirements are still the same.
>>
>
> Okay.
>
> Do server and example both resolve to the same IP?
>
> 2) Hence I added firewall rule to redirect port 443 to 8443. And the url
>> https://example.lbg.com started working but its pointing to
>> https://server.lbg.com:8443 indeed and not https://server.lbg.com:8443/to
>> wl
>>
>> But then they wanted the point 1 to have it. If I understood correctly. So
>> basically to achieve this we wanted a reverse proxy setup ?
>>
>> I didnot define any additional host in server.xml file on just left to
>> default to  local host.
>>
>
> Here's what you have to do in order to support this odd configuration.
>
> 1. Configure your firewall to route port 443 -> 8443. I suspect this is
> already done.
>
> 2. Deploy Tomcat on server.lbg.com with a  on port 8443. This
> is the default, so there shouldn't be anything to do. I suspect this is
> already done. You should set proxyPort="443" and proxyName="
> example.lbg.com" in your . This will ensure that any URLs
> generated by Tomcat or your application will point to
> https://example.lbg.com/ and not to server.lbg.com or have a port number
> or whatever.
>
> 3. Re-name your application directory or WAR file from towl -> ROOT (upper
> case is important). So if you have tomcat/webapps/towl re-name that to
> tomcat/webapps/ROOT or if you have tomcat/webapps/towl.war re-name that to
> tomcat/webapps/ROOT.war.
>
> The last thing to do is get /towl to re-direct to /. There are a few ways
> of doing that.
>
> 4a. Configure your application (now called ROOT and deployed on / and not
> /towl anymore) to handle the /towl URL and specifically redirect this back
> to /. This is oddly specific and has the application trying to redirect to
> itself which is weird.
>
> 4b. Create a new application called towl or towl.war which will be
> deployed on /towl and have THAT redirect to /. I think this is cleaner
> because you can call the application anything you'd like and it will still
> work. You don't have to match URL patterns yourself, you just re-name the
> WAR file if you suddenly want to use /towl2 instead of /towl.
>
> There are several ways to redirect.
>
> 5a. Use the rewrite valve and map /(*) to (global redirect) /\1. A few
> notes: (1) the (*) means "capture this string" and \1 means "put the string
> back. This allows you to redirect /towl/foo/bar to /foo/bar instead of
> losing the /foo/bar. This syntax may not be perfect, adapt it to your
> needs. (2) Remember that the towl application is deployed on /towl so you
> don't want to redirect /towl/foo/bar you only want redirect /foo/bar since
> the URL will be relative to the current context (/towl). Got that? Finally,
> (3) you need to use a global redirect that does *NOT* redirect back to the
> /towl application. Normally, if you redirect to /foo you'll get an
> application-relative redirect from something like a rewrite
> valve/filter/whatever. Take care to redirect relative to the SERVER and not
> to the application.
>
> 5b. Write your own servlet to do a specific redirect.
>
> I hope that helps,
> -chris
>
> On Wednesday, May 8, 2024, Christopher Schultz <
>> ch...@christopherschultz.net>
>> wrote:
>>
>> Lavanya,
>>>
>>> On 5/8/24 06:48, lavanya tech wrote:
>>>
>>> I figured out how I can it make it work with 443. Now the URls are
 working.
 I added iptables route 443 to 8443 and it started working.

 nslookup example.lbg.com

 Non-authoritative answer:
 Name:server.lbg.com
 Address:  192.168.200.105
 Aliases:  example.lbg.com


 I have some application towl running with apache tomcat. I have the
 below
 URLs working.

 https://server.lbg.com:8443/towl
 https://server.lbg.com
 https://example.lbg.com
 https://example.lbg.com/towl


 Now i wanted to disable the url https://example.lbg.com/towl and
 https://server.lbg.com and access only the other remaining two.


>>>
>>
>>
>>> I would *highly* recommend that you pick either /towl or / and not try 

Re: Regarding Tomcat url redirection

2024-05-09 Thread Christopher Schultz

Lavanya,

On 5/9/24 02:58, lavanya tech wrote:

Just giving background again of this topic again.

1) The application team who is working they wanted to access the url
https://server.lbg.com:8443/towl —> which should redirect or point to
https://example.lbg.com

Is that a typo? You want specifically https://server.lbg.com/towl and
https://example.lbg.com/ to point to your application?
   — It’s not the Typo the requirements are still the same.


Okay.

Do server and example both resolve to the same IP?


2) Hence I added firewall rule to redirect port 443 to 8443. And the url
https://example.lbg.com started working but its pointing to
https://server.lbg.com:8443 indeed and not https://server.lbg.com:8443/towl

But then they wanted the point 1 to have it. If I understood correctly. So
basically to achieve this we wanted a reverse proxy setup ?

I didnot define any additional host in server.xml file on just left to
default to  local host.


Here's what you have to do in order to support this odd configuration.

1. Configure your firewall to route port 443 -> 8443. I suspect this is 
already done.


2. Deploy Tomcat on server.lbg.com with a  on port 8443. This 
is the default, so there shouldn't be anything to do. I suspect this is 
already done. You should set proxyPort="443" and 
proxyName="example.lbg.com" in your . This will ensure that 
any URLs generated by Tomcat or your application will point to 
https://example.lbg.com/ and not to server.lbg.com or have a port number 
or whatever.


3. Re-name your application directory or WAR file from towl -> ROOT 
(upper case is important). So if you have tomcat/webapps/towl re-name 
that to tomcat/webapps/ROOT or if you have tomcat/webapps/towl.war 
re-name that to tomcat/webapps/ROOT.war.


The last thing to do is get /towl to re-direct to /. There are a few 
ways of doing that.


4a. Configure your application (now called ROOT and deployed on / and 
not /towl anymore) to handle the /towl URL and specifically redirect 
this back to /. This is oddly specific and has the application trying to 
redirect to itself which is weird.


4b. Create a new application called towl or towl.war which will be 
deployed on /towl and have THAT redirect to /. I think this is cleaner 
because you can call the application anything you'd like and it will 
still work. You don't have to match URL patterns yourself, you just 
re-name the WAR file if you suddenly want to use /towl2 instead of /towl.


There are several ways to redirect.

5a. Use the rewrite valve and map /(*) to (global redirect) /\1. A few 
notes: (1) the (*) means "capture this string" and \1 means "put the 
string back. This allows you to redirect /towl/foo/bar to /foo/bar 
instead of losing the /foo/bar. This syntax may not be perfect, adapt it 
to your needs. (2) Remember that the towl application is deployed on 
/towl so you don't want to redirect /towl/foo/bar you only want redirect 
/foo/bar since the URL will be relative to the current context (/towl). 
Got that? Finally, (3) you need to use a global redirect that does *NOT* 
redirect back to the /towl application. Normally, if you redirect to 
/foo you'll get an application-relative redirect from something like a 
rewrite valve/filter/whatever. Take care to redirect relative to the 
SERVER and not to the application.


5b. Write your own servlet to do a specific redirect.

I hope that helps,
-chris


On Wednesday, May 8, 2024, Christopher Schultz 
wrote:


Lavanya,

On 5/8/24 06:48, lavanya tech wrote:


I figured out how I can it make it work with 443. Now the URls are
working.
I added iptables route 443 to 8443 and it started working.

nslookup example.lbg.com

Non-authoritative answer:
Name:server.lbg.com
Address:  192.168.200.105
Aliases:  example.lbg.com


I have some application towl running with apache tomcat. I have the below
URLs working.

https://server.lbg.com:8443/towl
https://server.lbg.com
https://example.lbg.com
https://example.lbg.com/towl


Now i wanted to disable the url https://example.lbg.com/towl and
https://server.lbg.com and access only the other remaining two.








I would *highly* recommend that you pick either /towl or / and not try to
do both, unless you want to deploy the application twice (which is fine,
just deploy towl.war and ROOT.war as copies of each other). If you try to
re-write /towl to / or / to /towl, you'll find you spend the rest of your
days tracking-down edge-cases and "fixing" them -- likely making things
confusing and, probably, worse.

In the end our goal to makesure that the links are not  always dead as soon

as the towl is moved to a new machine. Can you pelase assit me how to do
that?



The goal should be that "moving" the application only means changing DNS
and everything else works as expected.

If you:

1. Deploy the application with a single context (e.g. /towl, which I
recommend)

2. Re-direct / to /towl (this requires a reverse-proxy or a ROOT
application that does nothing but redirect

Re: Regarding Tomcat url redirection

2024-05-08 Thread lavanya tech
Hi Chris,

Thanks.

Just giving background again of this topic again.

1) The application team who is working they wanted to access the url
https://server.lbg.com:8443/towl —> which should redirect or point to
https://example.lbg.com

Is that a typo? You want specifically https://server.lbg.com/towl and
https://example.lbg.com/ to point to your application?
  — It’s not the Typo the requirements are still the same.

2) Hence I added firewall rule to redirect port 443 to 8443. And the url
https://example.lbg.com started working but its pointing to
https://server.lbg.com:8443 indeed and not https://server.lbg.com:8443/towl

But then they wanted the point 1 to have it. If I understood correctly. So
basically to achieve this we wanted a reverse proxy setup ?

I didnot define any additional host in server.xml file on just left to
default to  local host.



Thanks,
Lavanya



On Wednesday, May 8, 2024, Christopher Schultz 
wrote:

> Lavanya,
>
> On 5/8/24 06:48, lavanya tech wrote:
>
>> I figured out how I can it make it work with 443. Now the URls are
>> working.
>> I added iptables route 443 to 8443 and it started working.
>>
>> nslookup example.lbg.com
>>
>> Non-authoritative answer:
>> Name:server.lbg.com
>> Address:  192.168.200.105
>> Aliases:  example.lbg.com
>>
>>
>> I have some application towl running with apache tomcat. I have the below
>> URLs working.
>>
>> https://server.lbg.com:8443/towl
>> https://server.lbg.com
>> https://example.lbg.com
>> https://example.lbg.com/towl
>>
>>
>> Now i wanted to disable the url https://example.lbg.com/towl and
>> https://server.lbg.com and access only the other remaining two.
>>
>


>
> I would *highly* recommend that you pick either /towl or / and not try to
> do both, unless you want to deploy the application twice (which is fine,
> just deploy towl.war and ROOT.war as copies of each other). If you try to
> re-write /towl to / or / to /towl, you'll find you spend the rest of your
> days tracking-down edge-cases and "fixing" them -- likely making things
> confusing and, probably, worse.
>
> In the end our goal to makesure that the links are not  always dead as soon
>> as the towl is moved to a new machine. Can you pelase assit me how to do
>> that?
>>
>
> The goal should be that "moving" the application only means changing DNS
> and everything else works as expected.
>
> If you:
>
> 1. Deploy the application with a single context (e.g. /towl, which I
> recommend)
>
> 2. Re-direct / to /towl (this requires a reverse-proxy or a ROOT
> application that does nothing but redirect ; my personal preference)
>
> 3. Do not define any  other than "localhost" and make it the
> default. Do not bother with any  elements since they are not
> necessary.
>
> Moving the application should only require that you:
>
> 4. Deploy the same application with the same configuration in the new
> location
>
> 5. Change DNS to point example.lbg.com and server.lbg.com to the new
> location of the service
>
> Hope that helps,
> -chris
>
> On Tue, Apr 30, 2024 at 5:44 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> Lavanya,
>
> On 4/30/24 07:10, lavanya tech wrote:
>
> Can you tell me how to do the below ? How should I setup Tomcat in
> server.xml ?
>
>
> If you want to use port 443 (the default port for HTTPS) then you will
> need to change Tomcat to bind to port 443 (if that's allowed on your OS)
> or arrange to have port 443 routed to port 8443. You may need additional
> configuration in Tomcat (specifically: proxyPort) to avoid having Tomcat
> generate URLs with ":8443" in them.
>
> Looking forward to your reply.
>
>
> If Tomcat is listening on port 8443 then you will need to include that
> in your URL, period. If you want to allow URLs without a port number,
> you will have to arrange to have something listening on port 443.
>
> On Windows, Tomcat can listen directly on port 443. On UNIX and
> UNIX-like systems, you won't be able to do this without running Tomcat
> as root WHICH YOU ABSOLUTELY SHOULD NOT DO.
>
> There are other ways to get port 443 working, but I'll need to know more
> about your environment. The port issue is "easier" than figuring out
> whatever is going on with your DNS, aliases, etc. so I would recommend
> we fix one thing at a time.
>
> -chris
>
> On Mon, Apr 29, 2024 at 2:03 PM lavanya tech 
> wrote:
>
> Hi Chris,
>
> There is no issues with browser, because I tested with different
>
> browsers
>
> and it all works fine. I am sure that there is no issue with the
> certificate.
>Because I was able to establish successful connections with port
>
> 8443, it
>
> just doesnot work with out port
>
>curl  https://example.lbg.com/towl
> curl: (56) Received HTTP code 504 from proxy after CONNECT
> curl: (56) Received HTTP code 504 from proxy after CONNECT
>
>
> If you want to use port 443 (the default port for HTTPS) then you will
> need to change Tomcat to bind to port 443 (if that's allowed on your OS)
> or arrange to have port 44

Re: Regarding Tomcat url redirection

2024-05-08 Thread Christopher Schultz
not

just
anything that ends in "example.com". You'd have to use a

glob/regex if

you wanted to check for [anything and maybe nothing.]

example.com.


You'd also have to make sure that your application is serving

responses

to requests to / which is why I'm recommending you use the

ROOT

web

application name instead of "towl".

-chris

On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 09:34, lavanya tech wrote:


I am attaching server.xml and context.xml and

rewrite.config

files.

The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml


className="org.apache.catalina.valves.rewrite.RewriteValve"



/>








This file ^^^ is in the wrong place. It should be in


/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml




/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config


https://www.example.com:/example

[R=301,L]




Why do you have < symbols at the beginning of these lines?

server.xml


> [...]




  
unpackWARs="true"



autoDeploy="true">

  



It's best not to define any  in server.xml. I would

remove



this



 entirely and allow Tomcat to auto-reploy from your

webapps/towl directory. If you need this application to be

deployed

as
the ROOT context (on / and not /towl) then you should

re-name

/git/app/apache-tomcat-10.1.11/webapps/towl to
/git/app/apache-tomcat-10.1.11/webapps/ROOT

You also don't need a  for example.com as well as

adding

an

 for the same domain (though this is probably to

anonymize the

configuration). You can feel free to simply use the

"localhost"


as the default  and deploy everything into it. This

makes

your

configuration changes relative to a stock Tomcat less

significant and

easier to apply to new versions if/when necessary.

-chris

On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 07:45, lavanya tech wrote:


I added classname rewrite valeus in contex.xml file .

 
 


className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



 

created rewrite.config so both of them is located under

conf

under
apache-tomcat.


 
example.com

[NC]
 https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml

should

be



placed



under webapps and rewrite.config file should be put in

WEB-INF



folder



of



apache-tomcat . I placed and restarted tomcat webserver but

still



it



doesnot redirect.




Can you give full paths to both server.xml and

rewrite.config,



re-post



your current server.xml  element, and the complete

contents



of



rewrite.config?


Have you looked at the log files after start?

-chris

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <



lavanyatech...@gmail.com





wrote:


Hi Thomas,


Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

 
 


className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



 


created rewrite.config so both of them is located under

conf



under



apache-tomcat.


So according to the documentaion they say context.xml

should

be



placed



under webapps and rewrite.config file should be put in

WEB-INF



folder



of



apache-tomcat


Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas <

ma...@apache.org>



wrote:





On 18/04/2024 12:05, lavanya tech wrote:



Hi Team,

I am using "Tomcat 10.1" in our environment and I

wanted to



redirect



url



from https://example.com to https://www.servercom:

and

for



this i



modified the server.xml as below in tomcat config, and the

below

configuration doesnot seems to work. Does anyone has

ideas.



Please



suggest.



The url alone https://www.servercom:/ already

works.

But



just



redirection from the old to one doesnot.



unpackWARs="true"



autoDeploy="true">


  
  example.com
  

  


className="org.apache.catalina.valves.rewrite.RewriteValve"/>



  
defaultHost="localhost">

  
appBase="app"



unpackWARs="true"



autoDeploy="true">

  
docBase="example"

/>

  example.com
  


className="org.apache.catalina.valves.rewrite.RewriteValve"/>



  
defaultHost="localhost">



  
appBase="app"

unpackWARs="true" autoDeploy="true">
   

Re: Regarding Tomcat url redirection

2024-05-08 Thread lavanya tech
t;> ch...@christopherschultz.net> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>> Ammu,
> >>>>>>>>>>>>
> >>>>>>>>>>>> On 4/19/24 08:32, lavanya tech wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Thank you very much. I removed  for example.com as
> well
> >>> as
> >>>>>>>>>>>>>
> >>>>>>>>>>>> adding
> >>>>>>>>>>
> >>>>>>>>>>> an
> >>>>>>>>>>>>
> >>>>>>>>>>>>>  in server.xml
> >>>>>>>>>>>>> I copied context.xml file
> >>>>>>>>>>>>>
> >>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
> >>>>>>>>>>>>> Removed < in rewrite.config files.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> But still I dont redirect the URL.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> If you have  in server.xml and also your application
> in
> >>>>>> the
> >>>>>>>>>>>> webapps/ directory, then you will be double-deploying your
> >>>>>> application.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Re-name /git/app/apache-tomcat-10.1.11/webapps/towl/ to be
> >>>>>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT (the capitals are
> >>>>>>>>>>>> important)
> >>>>>>>>>>>> and remove the  element from your server.xml.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Then start your server and read the logs.
> >>>>>>>>>>>>
> >>>>>>>>>>>> *nslookup alias.example.com <http://alias.example.com>
> >>>>>>>>>>>>> gives-->Non-authoritative answer:Name: www.example.com
> >>>>>>>>>>>>> <http://www.example.com>Address:  192.168.200.10Aliases:
> >>>>>>>>>>>>>
> >>>>>>>>>>>> alias.example.com
> >>>>>>>>>>>>
> >>>>>>>>>>>>> <http://alias.example.com>*
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Just to give some information here, *www.example.com
> >>>>>>>>>>>>> <http://www.example.com>* has alias* "alias.example.com
> >>>>>>>>>>>>> <http://alias.example.com>"*
> >>>>>>>>>>>>> But https://www.example.com:/example --> works fine with
> >>> out
> >>>>>>>>>>>>>
> >>>>>>>>>>>> issues
> >>>>>>>>>>
> >>>>>>>>>>> but
> >>>>>>>>>>>>
> >>>>>>>>>>>>> the alias doesnot works (https://alias.example.com)
> >>>>>>>>>>>>> So i am not sure if the redirect url helps or if its correct
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> Your rewrite configuration says that you have to be using host
> >>>>>>>>>>>> "example.com" but your request goes to www.example.com. Your
> >>>>>>>>>>>> configuration should only redirect a request such as:
> >>>>>>>>>>>>
> >>>>>>>>>>>> $ curl -v http://example.com:/something
> >>>>>>>>>>>>
> >>>>>>>>>>>> HTTP/1.1 301 Moved Permanently
> >>>>

Re: Regarding Tomcat url redirection

2024-04-30 Thread Christopher Schultz

created rewrite.config so both of them is located under

conf

under
apache-tomcat.



example.com

[NC]
https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml

should

be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat . I placed and restarted tomcat webserver but

still



it



doesnot redirect.




Can you give full paths to both server.xml and

rewrite.config,



re-post



your current server.xml  element, and the complete

contents



of



rewrite.config?


Have you looked at the log files after start?

-chris

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <



lavanyatech...@gmail.com





wrote:


Hi Thomas,


Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .



className="org.apache.catalina.valves.rewrite.RewriteValve"



/>






created rewrite.config so both of them is located under

conf



under



apache-tomcat.


So according to the documentaion they say context.xml

should

be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat


Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas <

ma...@apache.org>



wrote:





On 18/04/2024 12:05, lavanya tech wrote:



Hi Team,

I am using "Tomcat 10.1" in our environment and I

wanted to



redirect



url



from https://example.com to https://www.servercom: and

for



this i



modified the server.xml as below in tomcat config, and the

below

configuration doesnot seems to work. Does anyone has

ideas.



Please



suggest.



The url alone https://www.servercom:/ already

works.

But



just



redirection from the old to one doesnot.



unpackWARs="true"



autoDeploy="true">


 
 example.com
 

 


className="org.apache.catalina.valves.rewrite.RewriteValve"/>



 
defaultHost="localhost">

 
unpackWARs="true"



autoDeploy="true">

 
/>

 example.com
 


className="org.apache.catalina.valves.rewrite.RewriteValve"/>



 
defaultHost="localhost">



 
unpackWARs="true" autoDeploy="true">
 
docBase="example" />

 example.com
 
 
[NC]



 
https://www.servercom:/example/$1 [R=301,L]



1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest

re-write



rules



in



a



Host element (or any other element)?


 

 
 
 




You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark






-


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

For additional commands, e-mail:

users-h...@tomcat.apache.org










-


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

For additional commands, e-mail:

users-h...@tomcat.apache.org








-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org








-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org








-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org








-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-30 Thread lavanya tech
gt;>>>>> On 4/19/24 08:32, lavanya tech wrote:
>> >>>>>>>>>
>> >>>>>>>>>> Thank you very much. I removed  for example.com as well
>> as
>> >>>>>>>>>>
>> >>>>>>>>> adding
>> >>>>>>>
>> >>>>>>>> an
>> >>>>>>>>>
>> >>>>>>>>>>  in server.xml
>> >>>>>>>>>> I copied context.xml file
>> >>>>>>>>>>
>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
>> >>>>>>>>>> Removed < in rewrite.config files.
>> >>>>>>>>>>
>> >>>>>>>>>> But still I dont redirect the URL.
>> >>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> If you have  in server.xml and also your application in
>> >>> the
>> >>>>>>>>> webapps/ directory, then you will be double-deploying your
>> >>> application.
>> >>>>>>>>>
>> >>>>>>>>> Re-name /git/app/apache-tomcat-10.1.11/webapps/towl/ to be
>> >>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT (the capitals are
>> >>>>>>>>> important)
>> >>>>>>>>> and remove the  element from your server.xml.
>> >>>>>>>>>
>> >>>>>>>>> Then start your server and read the logs.
>> >>>>>>>>>
>> >>>>>>>>> *nslookup alias.example.com <http://alias.example.com>
>> >>>>>>>>>> gives-->Non-authoritative answer:Name: www.example.com
>> >>>>>>>>>> <http://www.example.com>Address:  192.168.200.10Aliases:
>> >>>>>>>>>>
>> >>>>>>>>> alias.example.com
>> >>>>>>>>>
>> >>>>>>>>>> <http://alias.example.com>*
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> Just to give some information here, *www.example.com
>> >>>>>>>>>> <http://www.example.com>* has alias* "alias.example.com
>> >>>>>>>>>> <http://alias.example.com>"*
>> >>>>>>>>>> But https://www.example.com:/example --> works fine with
>> out
>> >>>>>>>>>>
>> >>>>>>>>> issues
>> >>>>>>>
>> >>>>>>>> but
>> >>>>>>>>>
>> >>>>>>>>>> the alias doesnot works (https://alias.example.com)
>> >>>>>>>>>> So i am not sure if the redirect url helps or if its correct
>> >>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> Your rewrite configuration says that you have to be using host
>> >>>>>>>>> "example.com" but your request goes to www.example.com. Your
>> >>>>>>>>> configuration should only redirect a request such as:
>> >>>>>>>>>
>> >>>>>>>>> $ curl -v http://example.com:/something
>> >>>>>>>>>
>> >>>>>>>>> HTTP/1.1 301 Moved Permanently
>> >>>>>>>>> ...
>> >>>>>>>>> Location: https://www.example.com:/example
>> >>>>>>>>>
>> >>>>>>>>> If you make a request like:
>> >>>>>>>>>
>> >>>>>>>>> $ curl -v http://www.example.com:/something
>> >>>>>>>>>
>> >>>>>>>>> I wouldn't expect a redirect because of your "host" condition.
>> The
>> >>>>>>>>> "%{HTTP_HOST} example.com" looks at the entire Host header and
>> 

Re: Regarding Tomcat url redirection

2024-04-29 Thread lavanya tech
le.com>"*
> >>>>>>>>>> But https://www.example.com:/example --> works fine with
> out
> >>>>>>>>>>
> >>>>>>>>> issues
> >>>>>>>
> >>>>>>>> but
> >>>>>>>>>
> >>>>>>>>>> the alias doesnot works (https://alias.example.com)
> >>>>>>>>>> So i am not sure if the redirect url helps or if its correct
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Your rewrite configuration says that you have to be using host
> >>>>>>>>> "example.com" but your request goes to www.example.com. Your
> >>>>>>>>> configuration should only redirect a request such as:
> >>>>>>>>>
> >>>>>>>>> $ curl -v http://example.com:/something
> >>>>>>>>>
> >>>>>>>>> HTTP/1.1 301 Moved Permanently
> >>>>>>>>> ...
> >>>>>>>>> Location: https://www.example.com:/example
> >>>>>>>>>
> >>>>>>>>> If you make a request like:
> >>>>>>>>>
> >>>>>>>>> $ curl -v http://www.example.com:/something
> >>>>>>>>>
> >>>>>>>>> I wouldn't expect a redirect because of your "host" condition.
> The
> >>>>>>>>> "%{HTTP_HOST} example.com" looks at the entire Host header and
> not
> >>>>>>>>> just
> >>>>>>>>> anything that ends in "example.com". You'd have to use a
> >>> glob/regex if
> >>>>>>>>> you wanted to check for [anything and maybe nothing.]example.com
> .
> >>>>>>>>>
> >>>>>>>>> You'd also have to make sure that your application is serving
> >>> responses
> >>>>>>>>> to requests to / which is why I'm recommending you use the ROOT
> web
> >>>>>>>>> application name instead of "towl".
> >>>>>>>>>
> >>>>>>>>> -chris
> >>>>>>>>>
> >>>>>>>>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
> >>>>>>>>>> ch...@christopherschultz.net> wrote:
> >>>>>>>>>>
> >>>>>>>>>> Ammu,
> >>>>>>>>>>>
> >>>>>>>>>>> On 4/18/24 09:34, lavanya tech wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> I am attaching server.xml and context.xml and rewrite.config
> >>> files.
> >>>>>>>>>>>> The paths are
> >>>>>>>>>>>>
> >>>>>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
> >>>>>>>>>>>> 
> >>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>>>>>>>
> >>>>>>>>>> />
> >>>>>>>>>>>
> >>>>>>>>>>>>   
> >>>>>>>>>>>> 
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> This file ^^^ is in the wrong place. It should be in
> >>>>>>>>>>>
> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>> /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
> >>>>>>>>>>>>
> >>>>>>>>>>>>  >>>>>>>>>>>> https://www.example.com:/example
> >>> [R=301,L]
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> Why do you have < s

Re: Regarding Tomcat url redirection

2024-04-26 Thread Christopher Schultz
ps or if its correct



Your rewrite configuration says that you have to be using host
"example.com" but your request goes to www.example.com. Your
configuration should only redirect a request such as:

$ curl -v http://example.com:/something

HTTP/1.1 301 Moved Permanently
...
Location: https://www.example.com:/example

If you make a request like:

$ curl -v http://www.example.com:/something

I wouldn't expect a redirect because of your "host" condition. The
"%{HTTP_HOST} example.com" looks at the entire Host header and

not

just
anything that ends in "example.com". You'd have to use a

glob/regex if

you wanted to check for [anything and maybe nothing.]example.com.

You'd also have to make sure that your application is serving

responses

to requests to / which is why I'm recommending you use the ROOT

web

application name instead of "towl".

-chris

On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 09:34, lavanya tech wrote:


I am attaching server.xml and context.xml and rewrite.config

files.

The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml

  
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



  




This file ^^^ is in the wrong place. It should be in
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml



/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config


https://www.example.com:/example

[R=301,L]




Why do you have < symbols at the beginning of these lines?

server.xml


  > [...]





unpackWARs="true"



autoDeploy="true">





It's best not to define any  in server.xml. I would

remove



this



 entirely and allow Tomcat to auto-reploy from your

webapps/towl directory. If you need this application to be

deployed

as
the ROOT context (on / and not /towl) then you should re-name
/git/app/apache-tomcat-10.1.11/webapps/towl to
/git/app/apache-tomcat-10.1.11/webapps/ROOT

You also don't need a  for example.com as well as adding

an

 for the same domain (though this is probably to

anonymize the

configuration). You can feel free to simply use the "localhost"

as the default  and deploy everything into it. This makes

your

configuration changes relative to a stock Tomcat less

significant and

easier to apply to new versions if/when necessary.

-chris

On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 07:45, lavanya tech wrote:


I added classname rewrite valeus in contex.xml file .

   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



   

created rewrite.config so both of them is located under  conf
under
apache-tomcat.


   
example.com

[NC]
   https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should

be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat . I placed and restarted tomcat webserver but

still



it



doesnot redirect.




Can you give full paths to both server.xml and rewrite.config,


re-post



your current server.xml  element, and the complete

contents



of



rewrite.config?


Have you looked at the log files after start?

-chris

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <



lavanyatech...@gmail.com





wrote:


Hi Thomas,


Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



   


created rewrite.config so both of them is located under

conf



under



apache-tomcat.


So according to the documentaion they say context.xml

should be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat


Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas <

ma...@apache.org>



wrote:





On 18/04/2024 12:05, lavanya tech wrote:



Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted

to



redirect



url



from https://example.com to https://www.servercom: and

for



this i



modified the server.xml as below in tomcat config, and the

below

configuration doesnot seems to work. Does anyone has

ideas.



Please



suggest.



The url alone https://www.servercom:/ already works.

But



just



redirection from the old to one doesnot.



autoDeploy="true">



example.com




className="org.apache.catalina.valves.rewrite.RewriteValve"/>




defaultHost="localhost">


unpackWARs="true"



aut

Re: Regarding Tomcat url redirection

2024-04-26 Thread Christopher Schultz
 a redirect because of your "host" condition. The
"%{HTTP_HOST} example.com" looks at the entire Host header and not
just
anything that ends in "example.com". You'd have to use a

glob/regex if

you wanted to check for [anything and maybe nothing.]example.com.

You'd also have to make sure that your application is serving

responses

to requests to / which is why I'm recommending you use the ROOT web
application name instead of "towl".

-chris

On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 09:34, lavanya tech wrote:


I am attaching server.xml and context.xml and rewrite.config

files.

The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml

  
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



  




This file ^^^ is in the wrong place. It should be in
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml



/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config


https://www.example.com:/example

[R=301,L]




Why do you have < symbols at the beginning of these lines?

server.xml


  > [...]





unpackWARs="true"



autoDeploy="true">





It's best not to define any  in server.xml. I would

remove



this



 entirely and allow Tomcat to auto-reploy from your

webapps/towl directory. If you need this application to be

deployed

as
the ROOT context (on / and not /towl) then you should re-name
/git/app/apache-tomcat-10.1.11/webapps/towl to
/git/app/apache-tomcat-10.1.11/webapps/ROOT

You also don't need a  for example.com as well as adding

an

 for the same domain (though this is probably to

anonymize the

configuration). You can feel free to simply use the "localhost"

as the default  and deploy everything into it. This makes

your

configuration changes relative to a stock Tomcat less

significant and

easier to apply to new versions if/when necessary.

-chris

On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 07:45, lavanya tech wrote:


I added classname rewrite valeus in contex.xml file .

   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



   

created rewrite.config so both of them is located under  conf
under
apache-tomcat.


   
example.com

[NC]
   https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should

be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat . I placed and restarted tomcat webserver but

still



it



doesnot redirect.




Can you give full paths to both server.xml and rewrite.config,


re-post



your current server.xml  element, and the complete contents



of



rewrite.config?


Have you looked at the log files after start?

-chris

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <



lavanyatech...@gmail.com





wrote:


Hi Thomas,


Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



   


created rewrite.config so both of them is located under  conf


under



apache-tomcat.


So according to the documentaion they say context.xml should

be



placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat


Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas <

ma...@apache.org>



wrote:





On 18/04/2024 12:05, lavanya tech wrote:



Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to


redirect



url



from https://example.com to https://www.servercom: and

for



this i



modified the server.xml as below in tomcat config, and the below

configuration doesnot seems to work. Does anyone has ideas.


Please



suggest.



The url alone https://www.servercom:/ already works.

But



just



redirection from the old to one doesnot.



autoDeploy="true">



example.com




className="org.apache.catalina.valves.rewrite.RewriteValve"/>





unpackWARs="true"



autoDeploy="true">


example.com



className="org.apache.catalina.valves.rewrite.RewriteValve"/>




defaultHost="localhost">




unpackWARs="true" autoDeploy="true">

docBase="example" />

example.com

  

Re: Regarding Tomcat url redirection

2024-04-25 Thread lavanya tech
server.xml
>>> >>>>>>> I copied context.xml file
>>> >>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
>>> >>>>>>> Removed < in rewrite.config files.
>>> >>>>>>>
>>> >>>>>>> But still I dont redirect the URL.
>>> >>>>>>>
>>> >>>>>>
>>> >>>>>> If you have  in server.xml and also your application in
>>> the
>>> >>>>>> webapps/ directory, then you will be double-deploying your
>>> application.
>>> >>>>>>
>>> >>>>>> Re-name /git/app/apache-tomcat-10.1.11/webapps/towl/ to be
>>> >>>>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT (the capitals are
>>> >>>>>> important)
>>> >>>>>> and remove the  element from your server.xml.
>>> >>>>>>
>>> >>>>>> Then start your server and read the logs.
>>> >>>>>>
>>> >>>>>> *nslookup alias.example.com <http://alias.example.com>
>>> >>>>>>> gives-->Non-authoritative answer:Name: www.example.com
>>> >>>>>>> <http://www.example.com>Address:  192.168.200.10Aliases:
>>> >>>>>>>
>>> >>>>>> alias.example.com
>>> >>>>>>
>>> >>>>>>> <http://alias.example.com>*
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>> Just to give some information here, *www.example.com
>>> >>>>>>> <http://www.example.com>* has alias* "alias.example.com
>>> >>>>>>> <http://alias.example.com>"*
>>> >>>>>>> But https://www.example.com:/example --> works fine with out
>>> >>>>>>>
>>> >>>>>> issues
>>> >>>>
>>> >>>>> but
>>> >>>>>>
>>> >>>>>>> the alias doesnot works (https://alias.example.com)
>>> >>>>>>> So i am not sure if the redirect url helps or if its correct
>>> >>>>>>>
>>> >>>>>>
>>> >>>>>> Your rewrite configuration says that you have to be using host
>>> >>>>>> "example.com" but your request goes to www.example.com. Your
>>> >>>>>> configuration should only redirect a request such as:
>>> >>>>>>
>>> >>>>>> $ curl -v http://example.com:/something
>>> >>>>>>
>>> >>>>>> HTTP/1.1 301 Moved Permanently
>>> >>>>>> ...
>>> >>>>>> Location: https://www.example.com:/example
>>> >>>>>>
>>> >>>>>> If you make a request like:
>>> >>>>>>
>>> >>>>>> $ curl -v http://www.example.com:/something
>>> >>>>>>
>>> >>>>>> I wouldn't expect a redirect because of your "host" condition. The
>>> >>>>>> "%{HTTP_HOST} example.com" looks at the entire Host header and
>>> not
>>> >>>>>> just
>>> >>>>>> anything that ends in "example.com". You'd have to use a
>>> glob/regex if
>>> >>>>>> you wanted to check for [anything and maybe nothing.]example.com.
>>> >>>>>>
>>> >>>>>> You'd also have to make sure that your application is serving
>>> responses
>>> >>>>>> to requests to / which is why I'm recommending you use the ROOT
>>> web
>>> >>>>>> application name instead of "towl".
>>> >>>>>>
>>> >>>>>> -chris
>>> >>>>>>
>>> >>>>>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
>>> >>>>>>> ch...@christopherschultz.net> wrote:
>>> >>>>>>>
>>> >>>>>>> Ammu,
>>> >>>>>>>>
&

Re: Regarding Tomcat url redirection

2024-04-25 Thread lavanya tech
 <http://alias.example.com>*
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> Just to give some information here, *www.example.com
>> >>>>>>> <http://www.example.com>* has alias* "alias.example.com
>> >>>>>>> <http://alias.example.com>"*
>> >>>>>>> But https://www.example.com:/example --> works fine with out
>> >>>>>>>
>> >>>>>> issues
>> >>>>
>> >>>>> but
>> >>>>>>
>> >>>>>>> the alias doesnot works (https://alias.example.com)
>> >>>>>>> So i am not sure if the redirect url helps or if its correct
>> >>>>>>>
>> >>>>>>
>> >>>>>> Your rewrite configuration says that you have to be using host
>> >>>>>> "example.com" but your request goes to www.example.com. Your
>> >>>>>> configuration should only redirect a request such as:
>> >>>>>>
>> >>>>>> $ curl -v http://example.com:/something
>> >>>>>>
>> >>>>>> HTTP/1.1 301 Moved Permanently
>> >>>>>> ...
>> >>>>>> Location: https://www.example.com:/example
>> >>>>>>
>> >>>>>> If you make a request like:
>> >>>>>>
>> >>>>>> $ curl -v http://www.example.com:/something
>> >>>>>>
>> >>>>>> I wouldn't expect a redirect because of your "host" condition. The
>> >>>>>> "%{HTTP_HOST} example.com" looks at the entire Host header and not
>> >>>>>> just
>> >>>>>> anything that ends in "example.com". You'd have to use a
>> glob/regex if
>> >>>>>> you wanted to check for [anything and maybe nothing.]example.com.
>> >>>>>>
>> >>>>>> You'd also have to make sure that your application is serving
>> responses
>> >>>>>> to requests to / which is why I'm recommending you use the ROOT web
>> >>>>>> application name instead of "towl".
>> >>>>>>
>> >>>>>> -chris
>> >>>>>>
>> >>>>>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
>> >>>>>>> ch...@christopherschultz.net> wrote:
>> >>>>>>>
>> >>>>>>> Ammu,
>> >>>>>>>>
>> >>>>>>>> On 4/18/24 09:34, lavanya tech wrote:
>> >>>>>>>>
>> >>>>>>>>> I am attaching server.xml and context.xml and rewrite.config
>> files.
>> >>>>>>>>> The paths are
>> >>>>>>>>>
>> >>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
>> >>>>>>>>> 
>> >>>>>>>>>  > >>>>>>>>>
>> >>>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"
>> >>>>>>
>> >>>>>>> />
>> >>>>>>>>
>> >>>>>>>>>  
>> >>>>>>>>> 
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>> This file ^^^ is in the wrong place. It should be in
>> >>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
>> >>>>>>>>
>> >>>>>>>>
>> /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
>> >>>>>>>>>
>> >>>>>>>>> > >>>>>>>>> https://www.example.com:/example
>> [R=301,L]
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>> Why do you have < symbols at the beginning of these lines?
>> >>>>>>>>
>> >>>>>>>> server.xml
>> >>>>>

Re: Regarding Tomcat url redirection

2024-04-25 Thread lavanya tech
nds in "example.com". You'd have to use a
> glob/regex if
> >>>>>> you wanted to check for [anything and maybe nothing.]example.com.
> >>>>>>
> >>>>>> You'd also have to make sure that your application is serving
> responses
> >>>>>> to requests to / which is why I'm recommending you use the ROOT web
> >>>>>> application name instead of "towl".
> >>>>>>
> >>>>>> -chris
> >>>>>>
> >>>>>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
> >>>>>>> ch...@christopherschultz.net> wrote:
> >>>>>>>
> >>>>>>> Ammu,
> >>>>>>>>
> >>>>>>>> On 4/18/24 09:34, lavanya tech wrote:
> >>>>>>>>
> >>>>>>>>> I am attaching server.xml and context.xml and rewrite.config
> files.
> >>>>>>>>> The paths are
> >>>>>>>>>
> >>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
> >>>>>>>>> 
> >>>>>>>>>   >>>>>>>>>
> >>>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>>>>
> >>>>>>> />
> >>>>>>>>
> >>>>>>>>>  
> >>>>>>>>> 
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> This file ^^^ is in the wrong place. It should be in
> >>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
> >>>>>>>>
> >>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
> >>>>>>>>>
> >>>>>>>>>  >>>>>>>>> https://www.example.com:/example
> [R=301,L]
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> Why do you have < symbols at the beginning of these lines?
> >>>>>>>>
> >>>>>>>> server.xml
> >>>>>>>>>
> >>>>>>>>>  > [...]
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>> >>>>>>>>>
> >>>>>>>> unpackWARs="true"
> >>>>
> >>>>> autoDeploy="true">
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> It's best not to define any  in server.xml. I would
> remove
> >>>>>>>>
> >>>>>>> this
> >>>>
> >>>>>  entirely and allow Tomcat to auto-reploy from your
> >>>>>>>> webapps/towl directory. If you need this application to be
> deployed
> >>>>>>>> as
> >>>>>>>> the ROOT context (on / and not /towl) then you should re-name
> >>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl to
> >>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT
> >>>>>>>>
> >>>>>>>> You also don't need a  for example.com as well as adding an
> >>>>>>>>  for the same domain (though this is probably to anonymize
> the
> >>>>>>>> configuration). You can feel free to simply use the "localhost"
> >>>>>>>> 
> >>>>>>>> as the default  and deploy everything into it. This makes
> your
> >>>>>>>> configuration changes relative to a stock Tomcat less significant
> and
> >>>>>>>> easier to apply to new versions if/when necessary.
> >>>>>>>>
> >>>>>>>> -chris
> >>>>>>>>
> >>>>>>>> On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
> >>>>>>>>> ch...@christopherschultz.net> wrote:
> >>>>>>>>>
> >>>>>>>>> Ammu,
> >>>>>>>>>>
> >>>>>>>>>> On 4/1

Re: Regarding Tomcat url redirection

2024-04-24 Thread Christopher Schultz
 server.xml. I would remove


this



 entirely and allow Tomcat to auto-reploy from your

webapps/towl directory. If you need this application to be deployed
as
the ROOT context (on / and not /towl) then you should re-name
/git/app/apache-tomcat-10.1.11/webapps/towl to
/git/app/apache-tomcat-10.1.11/webapps/ROOT

You also don't need a  for example.com as well as adding an
 for the same domain (though this is probably to anonymize the
configuration). You can feel free to simply use the "localhost"

as the default  and deploy everything into it. This makes your
configuration changes relative to a stock Tomcat less significant and
easier to apply to new versions if/when necessary.

-chris

On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <

ch...@christopherschultz.net> wrote:

Ammu,


On 4/18/24 07:45, lavanya tech wrote:


I added classname rewrite valeus in contex.xml file .

  
  
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



  

created rewrite.config so both of them is located under  conf
under
apache-tomcat.


  https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should be


placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat . I placed and restarted tomcat webserver but still



it



doesnot redirect.




Can you give full paths to both server.xml and rewrite.config,


re-post



your current server.xml  element, and the complete contents



of



rewrite.config?


Have you looked at the log files after start?

-chris

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <



lavanyatech...@gmail.com





wrote:


Hi Thomas,


Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

  
  
className="org.apache.catalina.valves.rewrite.RewriteValve"



/>



  


created rewrite.config so both of them is located under  conf


under



apache-tomcat.


So according to the documentaion they say context.xml should be


placed



under webapps and rewrite.config file should be put in WEB-INF



folder



of



apache-tomcat


Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas 


wrote:





On 18/04/2024 12:05, lavanya tech wrote:



Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to


redirect



url



from https://example.com to https://www.servercom: and for



this i



modified the server.xml as below in tomcat config, and the below

configuration doesnot seems to work. Does anyone has ideas.


Please



suggest.



The url alone https://www.servercom:/ already works. But


just



redirection from the old to one doesnot.



autoDeploy="true">


   
   example.com
   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"/>


   
   
unpackWARs="true"



autoDeploy="true">

   
   example.com
   
className="org.apache.catalina.valves.rewrite.RewriteValve"/>


   
defaultHost="localhost">



   
unpackWARs="true" autoDeploy="true">
   
   example.com
   
   
[NC]



   
https://www.servercom:/example/$1 [R=301,L]



1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write


rules



in



a



Host element (or any other element)?


   

   
   
   




You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark




-


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

For additional commands, e-mail: users-h...@tomcat.apache.org









-


To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org

For additional commands, e-mail: users-h...@tomcat.apache.org







-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-24 Thread lavanya tech
>>>> issues
>>>
>>>> but
>>>>>
>>>>>> the alias doesnot works (https://alias.example.com)
>>>>>> So i am not sure if the redirect url helps or if its correct
>>>>>>
>>>>>
>>>>> Your rewrite configuration says that you have to be using host
>>>>> "example.com" but your request goes to www.example.com. Your
>>>>> configuration should only redirect a request such as:
>>>>>
>>>>> $ curl -v http://example.com:/something
>>>>>
>>>>> HTTP/1.1 301 Moved Permanently
>>>>> ...
>>>>> Location: https://www.example.com:/example
>>>>>
>>>>> If you make a request like:
>>>>>
>>>>> $ curl -v http://www.example.com:/something
>>>>>
>>>>> I wouldn't expect a redirect because of your "host" condition. The
>>>>> "%{HTTP_HOST} example.com" looks at the entire Host header and not
>>>>> just
>>>>> anything that ends in "example.com". You'd have to use a glob/regex if
>>>>> you wanted to check for [anything and maybe nothing.]example.com.
>>>>>
>>>>> You'd also have to make sure that your application is serving responses
>>>>> to requests to / which is why I'm recommending you use the ROOT web
>>>>> application name instead of "towl".
>>>>>
>>>>> -chris
>>>>>
>>>>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
>>>>>> ch...@christopherschultz.net> wrote:
>>>>>>
>>>>>> Ammu,
>>>>>>>
>>>>>>> On 4/18/24 09:34, lavanya tech wrote:
>>>>>>>
>>>>>>>> I am attaching server.xml and context.xml and rewrite.config files.
>>>>>>>> The paths are
>>>>>>>>
>>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
>>>>>>>> 
>>>>>>>> >>>>>>>
>>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"
>>>>>
>>>>>> />
>>>>>>>
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>
>>>>>>> This file ^^^ is in the wrong place. It should be in
>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
>>>>>>>
>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
>>>>>>>>
>>>>>>>> >>>>>>> https://www.example.com:/example [R=301,L]
>>>>>>>>
>>>>>>>
>>>>>>> Why do you have < symbols at the beginning of these lines?
>>>>>>>
>>>>>>> server.xml
>>>>>>>>
>>>>>>>> > [...]
>>>>>>>
>>>>>>>>
>>>>>>>>   >>>>>>>
>>>>>>> unpackWARs="true"
>>>
>>>> autoDeploy="true">
>>>>>>>>   
>>>>>>>>
>>>>>>>
>>>>>>> It's best not to define any  in server.xml. I would remove
>>>>>>>
>>>>>> this
>>>
>>>>  entirely and allow Tomcat to auto-reploy from your
>>>>>>> webapps/towl directory. If you need this application to be deployed
>>>>>>> as
>>>>>>> the ROOT context (on / and not /towl) then you should re-name
>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/towl to
>>>>>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT
>>>>>>>
>>>>>>> You also don't need a  for example.com as well as adding an
>>>>>>>  for the same domain (though this is probably to anonymize the
>>>>>>> configuration). You can feel free to simply use the "localhost"
>>>>>>> 
>>>>>>> as the default  and deploy everything into it. This makes your
>>>>>>> configuration c

Re: Regarding Tomcat url redirection

2024-04-24 Thread Christopher Schultz
omcat . I placed and restarted tomcat webserver but still

it

doesnot redirect.


Can you give full paths to both server.xml and rewrite.config,

re-post

your current server.xml  element, and the complete contents

of

rewrite.config?

Have you looked at the log files after start?

-chris


On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <

lavanyatech...@gmail.com



wrote:


Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

 
 
className="org.apache.catalina.valves.rewrite.RewriteValve"

/>

 

created rewrite.config so both of them is located under  conf

under

apache-tomcat.

So according to the documentaion they say context.xml should be

placed

under webapps and rewrite.config file should be put in WEB-INF

folder

of

apache-tomcat

Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas 

wrote:



On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to

redirect

url

from https://example.com to https://www.servercom: and for

this i

modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas.

Please

suggest.

The url alone https://www.servercom:/ already works. But

just

redirection from the old to one doesnot.


autoDeploy="true">

  
  example.com
  
  
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

  
  
unpackWARs="true"

autoDeploy="true">
  
  example.com
  
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

  
defaultHost="localhost">

  
  
  example.com
  
  
[NC]

  https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write

rules

in

a

Host element (or any other element)?


  
  
  
  



You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark



-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org








-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-24 Thread lavanya tech
 >> ...
> >> Location: https://www.example.com:/example
> >>
> >> If you make a request like:
> >>
> >> $ curl -v http://www.example.com:/something
> >>
> >> I wouldn't expect a redirect because of your "host" condition. The
> >> "%{HTTP_HOST} example.com" looks at the entire Host header and not just
> >> anything that ends in "example.com". You'd have to use a glob/regex if
> >> you wanted to check for [anything and maybe nothing.]example.com.
> >>
> >> You'd also have to make sure that your application is serving responses
> >> to requests to / which is why I'm recommending you use the ROOT web
> >> application name instead of "towl".
> >>
> >> -chris
> >>
> >>> On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
> >>> ch...@christopherschultz.net> wrote:
> >>>
> >>>> Ammu,
> >>>>
> >>>> On 4/18/24 09:34, lavanya tech wrote:
> >>>>> I am attaching server.xml and context.xml and rewrite.config files.
> >>>>> The paths are
> >>>>>
> >>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
> >>>>> 
> >>>>> >> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>> />
> >>>>>
> >>>>> 
> >>>>
> >>>> This file ^^^ is in the wrong place. It should be in
> >>>> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
> >>>>
> >>>>> /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
> >>>>>
> >>>>>  >>>>> https://www.example.com:/example [R=301,L]
> >>>>
> >>>> Why do you have < symbols at the beginning of these lines?
> >>>>
> >>>>> server.xml
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>   unpackWARs="true"
> >>>>> autoDeploy="true">
> >>>>>  
> >>>>
> >>>> It's best not to define any  in server.xml. I would remove
> this
> >>>>  entirely and allow Tomcat to auto-reploy from your
> >>>> webapps/towl directory. If you need this application to be deployed as
> >>>> the ROOT context (on / and not /towl) then you should re-name
> >>>> /git/app/apache-tomcat-10.1.11/webapps/towl to
> >>>> /git/app/apache-tomcat-10.1.11/webapps/ROOT
> >>>>
> >>>> You also don't need a  for example.com as well as adding an
> >>>>  for the same domain (though this is probably to anonymize the
> >>>> configuration). You can feel free to simply use the "localhost" 
> >>>> as the default  and deploy everything into it. This makes your
> >>>> configuration changes relative to a stock Tomcat less significant and
> >>>> easier to apply to new versions if/when necessary.
> >>>>
> >>>> -chris
> >>>>
> >>>>> On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
> >>>>> ch...@christopherschultz.net> wrote:
> >>>>>
> >>>>>> Ammu,
> >>>>>>
> >>>>>> On 4/18/24 07:45, lavanya tech wrote:
> >>>>>>> I added classname rewrite valeus in contex.xml file .
> >>>>>>>
> >>>>>>> 
> >>>>>>>  >>>> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>>>> />
> >>>>>>> 
> >>>>>>>
> >>>>>>> created rewrite.config so both of them is located under  conf under
> >>>>>>> apache-tomcat.
> >>>>>>>
> >>>>>>>
> >>>>>>>  >>>>>>>  >>>>>>> https://www.example.com:/example [R=301,L]
> >>>>>>>
> >>>>>>> So according to the documentaion they say context.xml should be
> >> placed
> >>>>>>> under webapps and rewrite.config file should be put in WEB-INF
> folder
>

Re: Regarding Tomcat url redirection

2024-04-23 Thread Christopher Schultz
n Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Ammu,

On 4/18/24 07:45, lavanya tech wrote:

I added classname rewrite valeus in contex.xml file .



className="org.apache.catalina.valves.rewrite.RewriteValve"

/>



created rewrite.config so both of them is located under  conf under
apache-tomcat.


https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should be

placed

under webapps and rewrite.config file should be put in WEB-INF folder

of

apache-tomcat . I placed and restarted tomcat webserver but still it
doesnot redirect.


Can you give full paths to both server.xml and rewrite.config, re-post
your current server.xml  element, and the complete contents

of

rewrite.config?

Have you looked at the log files after start?

-chris


On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <

lavanyatech...@gmail.com



wrote:


Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .



className="org.apache.catalina.valves.rewrite.RewriteValve"

/>



created rewrite.config so both of them is located under  conf under
apache-tomcat.

So according to the documentaion they say context.xml should be

placed

under webapps and rewrite.config file should be put in WEB-INF

folder

of

apache-tomcat

Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas 

wrote:



On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to

redirect

url

from https://example.com to https://www.servercom: and for

this i

modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please

suggest.

The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.


autoDeploy="true">

 
 example.com
 
 
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

 
 
unpackWARs="true"

autoDeploy="true">
 
 example.com
 
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

 
 
 
 example.com
 
 
[NC]

 https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write rules

in

a

Host element (or any other element)?


 
 
 
 



You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark



-

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-22 Thread lavanya tech
t;>
>> >>> 
>> >>
>> >> It's best not to define any  in server.xml. I would remove
>> this
>> >>  entirely and allow Tomcat to auto-reploy from your
>> >> webapps/towl directory. If you need this application to be deployed as
>> >> the ROOT context (on / and not /towl) then you should re-name
>> >> /git/app/apache-tomcat-10.1.11/webapps/towl to
>> >> /git/app/apache-tomcat-10.1.11/webapps/ROOT
>> >>
>> >> You also don't need a  for example.com as well as adding an
>> >>  for the same domain (though this is probably to anonymize the
>> >> configuration). You can feel free to simply use the "localhost" 
>> >> as the default  and deploy everything into it. This makes your
>> >> configuration changes relative to a stock Tomcat less significant and
>> >> easier to apply to new versions if/when necessary.
>> >>
>> >> -chris
>> >>
>> >>> On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
>> >>> ch...@christopherschultz.net> wrote:
>> >>>
>> >>>> Ammu,
>> >>>>
>> >>>> On 4/18/24 07:45, lavanya tech wrote:
>> >>>>> I added classname rewrite valeus in contex.xml file .
>> >>>>>
>> >>>>>
>> >>>>>> >> className="org.apache.catalina.valves.rewrite.RewriteValve"
>> >>>> />
>> >>>>>
>> >>>>>
>> >>>>> created rewrite.config so both of them is located under  conf under
>> >>>>> apache-tomcat.
>> >>>>>
>> >>>>>
>> >>>>>> >>>>>> >>>>> https://www.example.com:/example [R=301,L]
>> >>>>>
>> >>>>> So according to the documentaion they say context.xml should be
>> placed
>> >>>>> under webapps and rewrite.config file should be put in WEB-INF
>> folder
>> >> of
>> >>>>> apache-tomcat . I placed and restarted tomcat webserver but still it
>> >>>>> doesnot redirect.
>> >>>>
>> >>>> Can you give full paths to both server.xml and rewrite.config,
>> re-post
>> >>>> your current server.xml  element, and the complete contents
>> of
>> >>>> rewrite.config?
>> >>>>
>> >>>> Have you looked at the log files after start?
>> >>>>
>> >>>> -chris
>> >>>>
>> >>>>> On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <
>> lavanyatech...@gmail.com
>> >>>
>> >>>>> wrote:
>> >>>>>
>> >>>>>> Hi Thomas,
>> >>>>>>
>> >>>>>> Thanks for the fast response.
>> >>>>>>
>> >>>>>> I added classname rewrite valeus in contex.xml file .
>> >>>>>>
>> >>>>>>
>> >>>>>>> >> className="org.apache.catalina.valves.rewrite.RewriteValve"
>> >>>> />
>> >>>>>>
>> >>>>>>
>> >>>>>> created rewrite.config so both of them is located under  conf under
>> >>>>>> apache-tomcat.
>> >>>>>>
>> >>>>>> So according to the documentaion they say context.xml should be
>> placed
>> >>>>>> under webapps and rewrite.config file should be put in WEB-INF
>> folder
>> >> of
>> >>>>>> apache-tomcat
>> >>>>>>
>> >>>>>> Thnks,
>> >>>>>> Ammu
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas 
>> wrote:
>> >>>>>>
>> >>>>>>> On 18/04/2024 12:05, lavanya tech wrote:
>> >>>>>>>> Hi Team,
>> >>>>>>>>
>> >>>>>>>> I am using "Tomcat 10.1" in our environment and I wanted to
>> redirect
>> >>>> url
>> >>>>>>>> from https://example.com to https://www.servercom: and for
>> >> this i
>> >>>>>>>> modified the server.xml as below in tomcat config, and the below
>> >>>>>>>> configuration doesnot seems to work. Does anyone has ideas.
>> Please
>> >>>>>>> suggest.
>> >>>>>>>> The url alone https://www.servercom:/ already works. But
>> just
>> >>>>>>>> redirection from the old to one doesnot.
>> >>>>>>>>
>> >>>>>>>> > >>>>>>> autoDeploy="true">
>> >>>>>>>> 
>> >>>>>>>> example.com
>> >>>>>>>> 
>> >>>>>>>> > >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
>> >>>>>>>> 
>> >>>>>>>> > unpackWARs="true"
>> >>>>>>>> autoDeploy="true">
>> >>>>>>>> 
>> >>>>>>>> example.com
>> >>>>>>>> > >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
>> >>>>>>>> 
>> >>>>>>>> > >>>>>>>> unpackWARs="true" autoDeploy="true">
>> >>>>>>>> 
>> >>>>>>>> example.com
>> >>>>>>>> 
>> >>>>>>>> > [NC]
>> >>>>>>>> > >>>>>>>> https://www.servercom:/example/$1 [R=301,L]
>> >>>>>>>
>> >>>>>>> 1. That isn't valid XML.
>> >>>>>>>
>> >>>>>>> 2. Where in the Tomcat docs does it say you can nest re-write
>> rules
>> >> in
>> >>>> a
>> >>>>>>> Host element (or any other element)?
>> >>>>>>>
>> >>>>>>>> 
>> >>>>>>>> 
>> >>>>>>>> 
>> >>>>>>>> 
>> >>>>>>>> 
>> >>>>>>>
>> >>>>>>> You need to configure the RewriteValve.
>> >>>>>>> https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html
>> >>>>>>>
>> >>>>>>> Mark
>> >>>>>>>
>> >>>>>>>
>> -
>> >>>>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> >>>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> >>>>>>>
>> >>>>>>>
>> >>>>>
>> >>>>
>> >>>> -
>> >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> >>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> >>>>
>> >>>>
>> >>>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> >> For additional commands, e-mail: users-h...@tomcat.apache.org
>> >>
>> >>
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>


Re: Regarding Tomcat url redirection

2024-04-22 Thread lavanya tech
nd
> >> easier to apply to new versions if/when necessary.
> >>
> >> -chris
> >>
> >>> On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
> >>> ch...@christopherschultz.net> wrote:
> >>>
> >>>> Ammu,
> >>>>
> >>>> On 4/18/24 07:45, lavanya tech wrote:
> >>>>> I added classname rewrite valeus in contex.xml file .
> >>>>>
> >>>>>
> >>>>> >> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>> />
> >>>>>
> >>>>>
> >>>>> created rewrite.config so both of them is located under  conf under
> >>>>> apache-tomcat.
> >>>>>
> >>>>>
> >>>>> >>>>> >>>>> https://www.example.com:/example [R=301,L]
> >>>>>
> >>>>> So according to the documentaion they say context.xml should be
> placed
> >>>>> under webapps and rewrite.config file should be put in WEB-INF folder
> >> of
> >>>>> apache-tomcat . I placed and restarted tomcat webserver but still it
> >>>>> doesnot redirect.
> >>>>
> >>>> Can you give full paths to both server.xml and rewrite.config, re-post
> >>>> your current server.xml  element, and the complete contents
> of
> >>>> rewrite.config?
> >>>>
> >>>> Have you looked at the log files after start?
> >>>>
> >>>> -chris
> >>>>
> >>>>> On Thu, Apr 18, 2024 at 1:36 PM lavanya tech <
> lavanyatech...@gmail.com
> >>>
> >>>>> wrote:
> >>>>>
> >>>>>> Hi Thomas,
> >>>>>>
> >>>>>> Thanks for the fast response.
> >>>>>>
> >>>>>> I added classname rewrite valeus in contex.xml file .
> >>>>>>
> >>>>>>
> >>>>>> >> className="org.apache.catalina.valves.rewrite.RewriteValve"
> >>>> />
> >>>>>>
> >>>>>>
> >>>>>> created rewrite.config so both of them is located under  conf under
> >>>>>> apache-tomcat.
> >>>>>>
> >>>>>> So according to the documentaion they say context.xml should be
> placed
> >>>>>> under webapps and rewrite.config file should be put in WEB-INF
> folder
> >> of
> >>>>>> apache-tomcat
> >>>>>>
> >>>>>> Thnks,
> >>>>>> Ammu
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas 
> wrote:
> >>>>>>
> >>>>>>> On 18/04/2024 12:05, lavanya tech wrote:
> >>>>>>>> Hi Team,
> >>>>>>>>
> >>>>>>>> I am using "Tomcat 10.1" in our environment and I wanted to
> redirect
> >>>> url
> >>>>>>>> from https://example.com to https://www.servercom: and for
> >> this i
> >>>>>>>> modified the server.xml as below in tomcat config, and the below
> >>>>>>>> configuration doesnot seems to work. Does anyone has ideas. Please
> >>>>>>> suggest.
> >>>>>>>> The url alone https://www.servercom:/ already works. But just
> >>>>>>>> redirection from the old to one doesnot.
> >>>>>>>>
> >>>>>>>>  >>>>>>> autoDeploy="true">
> >>>>>>>> 
> >>>>>>>> example.com
> >>>>>>>> 
> >>>>>>>>  >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >>>>>>>> 
> >>>>>>>>  unpackWARs="true"
> >>>>>>>> autoDeploy="true">
> >>>>>>>> 
> >>>>>>>> example.com
> >>>>>>>>  >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >>>>>>>> 
> >>>>>>>>  >>>>>>>> unpackWARs="true" autoDeploy="true">
> >>>>>>>> 
> >>>>>>>> example.com
> >>>>>>>> 
> >>>>>>>>  [NC]
> >>>>>>>>  >>>>>>>> https://www.servercom:/example/$1 [R=301,L]
> >>>>>>>
> >>>>>>> 1. That isn't valid XML.
> >>>>>>>
> >>>>>>> 2. Where in the Tomcat docs does it say you can nest re-write rules
> >> in
> >>>> a
> >>>>>>> Host element (or any other element)?
> >>>>>>>
> >>>>>>>> 
> >>>>>>>> 
> >>>>>>>> 
> >>>>>>>> 
> >>>>>>>> 
> >>>>>>>
> >>>>>>> You need to configure the RewriteValve.
> >>>>>>> https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html
> >>>>>>>
> >>>>>>> Mark
> >>>>>>>
> >>>>>>>
> -
> >>>>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>
> >>>> -
> >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>>
> >>>>
> >>>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Regarding Tomcat url redirection

2024-04-19 Thread Christopher Schultz
ks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:


On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to redirect

url

from https://example.com to https://www.servercom: and for

this i

modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please

suggest.

The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.


autoDeploy="true">


example.com


className="org.apache.catalina.valves.rewrite.RewriteValve"/>




example.com

className="org.apache.catalina.valves.rewrite.RewriteValve"/>




example.com

https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write rules

in

a

Host element (or any other element)?









You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-19 Thread lavanya tech
Hi Chris,

Thank you very much. I removed  for example.com as well as adding an
 in server.xml
I copied context.xml file
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
Removed < in rewrite.config files.

But still I dont redirect the URL.

For your information






*nslookup alias.example.com <http://alias.example.com>
gives-->Non-authoritative answer:Name: www.example.com
<http://www.example.com>Address:  192.168.200.10Aliases:  alias.example.com
<http://alias.example.com>*


Just to give some information here, *www.example.com
<http://www.example.com>* has alias* "alias.example.com
<http://alias.example.com>"*
But https://www.example.com:/example --> works fine with out issues but
the alias doesnot works (https://alias.example.com)
So i am not sure if the redirect url helps or if its correct

Looking for some suggestions.

Thanks
Ammu

On Fri, Apr 19, 2024 at 1:21 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Ammu,
>
> On 4/18/24 09:34, lavanya tech wrote:
> > I am attaching server.xml and context.xml and rewrite.config files.
> > The paths are
> >
> > /git/app/apache-tomcat-10.1.11/webapps/towl/context.xml
> > 
> >   />
> >  
> > 
>
> This file ^^^ is in the wrong place. It should be in
> /git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml
>
> > /git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config
> >
> >  > https://www.example.com:/example [R=301,L]
>
> Why do you have < symbols at the beginning of these lines?
>
> > server.xml
> >
>  > [...]
> >
> > > autoDeploy="true">
> >
>
> It's best not to define any  in server.xml. I would remove this
>  entirely and allow Tomcat to auto-reploy from your
> webapps/towl directory. If you need this application to be deployed as
> the ROOT context (on / and not /towl) then you should re-name
> /git/app/apache-tomcat-10.1.11/webapps/towl to
> /git/app/apache-tomcat-10.1.11/webapps/ROOT
>
> You also don't need a  for example.com as well as adding an
>  for the same domain (though this is probably to anonymize the
> configuration). You can feel free to simply use the "localhost" 
> as the default  and deploy everything into it. This makes your
> configuration changes relative to a stock Tomcat less significant and
> easier to apply to new versions if/when necessary.
>
> -chris
>
> > On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Ammu,
> >>
> >> On 4/18/24 07:45, lavanya tech wrote:
> >>> I added classname rewrite valeus in contex.xml file .
> >>>
> >>>   
> >>>className="org.apache.catalina.valves.rewrite.RewriteValve"
> >> />
> >>>   
> >>>
> >>> created rewrite.config so both of them is located under  conf under
> >>> apache-tomcat.
> >>>
> >>>
> >>>>>>>>> https://www.example.com:/example [R=301,L]
> >>>
> >>> So according to the documentaion they say context.xml should be placed
> >>> under webapps and rewrite.config file should be put in WEB-INF folder
> of
> >>> apache-tomcat . I placed and restarted tomcat webserver but still it
> >>> doesnot redirect.
> >>
> >> Can you give full paths to both server.xml and rewrite.config, re-post
> >> your current server.xml  element, and the complete contents of
> >> rewrite.config?
> >>
> >> Have you looked at the log files after start?
> >>
> >> -chris
> >>
> >>> On Thu, Apr 18, 2024 at 1:36 PM lavanya tech  >
> >>> wrote:
> >>>
> >>>> Hi Thomas,
> >>>>
> >>>> Thanks for the fast response.
> >>>>
> >>>> I added classname rewrite valeus in contex.xml file .
> >>>>
> >>>>   
> >>>>className="org.apache.catalina.valves.rewrite.RewriteValve"
> >> />
> >>>>   
> >>>>
> >>>> created rewrite.config so both of them is located under  conf under
> >>>> apache-tomcat.
> >>>>
> >>>> So according to the documentaion they say context.xml should be placed
> >>>> under webapps and rewrite.config file should be put in WEB-INF folde

Re: Regarding Tomcat url redirection

2024-04-19 Thread Christopher Schultz

Ammu,

On 4/18/24 09:34, lavanya tech wrote:

I am attaching server.xml and context.xml and rewrite.config files.
The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml

 
 



This file ^^^ is in the wrong place. It should be in 
/git/app/apache-tomcat-10.1.11/webapps/towl/META-INF/context.xml



/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config

https://www.example.com:/example [R=301,L]


Why do you have < symbols at the beginning of these lines?


server.xml


> [...]


   
   


It's best not to define any  in server.xml. I would remove this 
 entirely and allow Tomcat to auto-reploy from your 
webapps/towl directory. If you need this application to be deployed as 
the ROOT context (on / and not /towl) then you should re-name 
/git/app/apache-tomcat-10.1.11/webapps/towl to 
/git/app/apache-tomcat-10.1.11/webapps/ROOT


You also don't need a  for example.com as well as adding an 
 for the same domain (though this is probably to anonymize the 
configuration). You can feel free to simply use the "localhost"  
as the default  and deploy everything into it. This makes your 
configuration changes relative to a stock Tomcat less significant and 
easier to apply to new versions if/when necessary.


-chris


On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:


Ammu,

On 4/18/24 07:45, lavanya tech wrote:

I added classname rewrite valeus in contex.xml file .

  
  
/>

  

created rewrite.config so both of them is located under  conf under
apache-tomcat.


  https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat . I placed and restarted tomcat webserver but still it
doesnot redirect.


Can you give full paths to both server.xml and rewrite.config, re-post
your current server.xml  element, and the complete contents of
rewrite.config?

Have you looked at the log files after start?

-chris


On Thu, Apr 18, 2024 at 1:36 PM lavanya tech 
wrote:


Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

  
  
/>

  

created rewrite.config so both of them is located under  conf under
apache-tomcat.

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat

Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:


On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to redirect

url

from https://example.com to https://www.servercom: and for this i
modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please

suggest.

The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.


autoDeploy="true">

   
   example.com
   
   
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

   
   
   
   example.com
   
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

   
   
   
   example.com
   
   https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write rules in

a

Host element (or any other element)?


   
   
   
   



You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-18 Thread lavanya tech
Hi Chris,

Thanks for message,

I am attaching server.xml and context.xml and rewrite.config files.
The paths are

/git/app/apache-tomcat-10.1.11/webapps/towl/context.xml





/git/app/apache-tomcat-10.1.11/webapps/towl/WEB-INF/rewrite.config

https://www.example.com:/example [R=301,L]

server.xml






  
  
  
  
  
  
  
  

  
  


  

  
  



























  
  

  
  


  

  
  
  example.com
  
  







  

  


Thanks
Ammu

On Thu, Apr 18, 2024 at 2:17 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Ammu,
>
> On 4/18/24 07:45, lavanya tech wrote:
> > I added classname rewrite valeus in contex.xml file .
> >
> >  
> >   />
> >  
> >
> > created rewrite.config so both of them is located under  conf under
> > apache-tomcat.
> >
> >
> >   >   > https://www.example.com:/example [R=301,L]
> >
> > So according to the documentaion they say context.xml should be placed
> > under webapps and rewrite.config file should be put in WEB-INF folder of
> > apache-tomcat . I placed and restarted tomcat webserver but still it
> > doesnot redirect.
>
> Can you give full paths to both server.xml and rewrite.config, re-post
> your current server.xml  element, and the complete contents of
> rewrite.config?
>
> Have you looked at the log files after start?
>
> -chris
>
> > On Thu, Apr 18, 2024 at 1:36 PM lavanya tech 
> > wrote:
> >
> >> Hi Thomas,
> >>
> >> Thanks for the fast response.
> >>
> >> I added classname rewrite valeus in contex.xml file .
> >>
> >>  
> >>   />
> >>  
> >>
> >> created rewrite.config so both of them is located under  conf under
> >> apache-tomcat.
> >>
> >> So according to the documentaion they say context.xml should be placed
> >> under webapps and rewrite.config file should be put in WEB-INF folder of
> >> apache-tomcat
> >>
> >> Thnks,
> >> Ammu
> >>
> >>
> >>
> >> On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:
> >>
> >>> On 18/04/2024 12:05, lavanya tech wrote:
> >>>> Hi Team,
> >>>>
> >>>> I am using "Tomcat 10.1" in our environment and I wanted to redirect
> url
> >>>> from https://example.com to https://www.servercom: and for this i
> >>>> modified the server.xml as below in tomcat config, and the below
> >>>> configuration doesnot seems to work. Does anyone has ideas. Please
> >>> suggest.
> >>>> The url alone https://www.servercom:/ already works. But just
> >>>> redirection from the old to one doesnot.
> >>>>
> >>>>  >>> autoDeploy="true">
> >>>>   
> >>>>   example.com
> >>>>   
> >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >>>>   
> >>>>>>>> autoDeploy="true">
> >>>>   
> >>>>   example.com
> >>>>>>> className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >>>>   
> >>>>>>>> unpackWARs="true" autoDeploy="true">
> >>>>   
> >>>>   example.com
> >>>>   
> >>>>>>>>>>>> https://www.servercom:/example/$1 [R=301,L]
> >>>
> >>> 1. That isn't valid XML.
> >>>
> >>> 2. Where in the Tomcat docs does it say you can nest re-write rules in
> a
> >>> Host element (or any other element)?
> >>>
> >>>>   
> >>>>   
> >>>>   
> >>>>   
> >>>> 
> >>>
> >>> You need to configure the RewriteValve.
> >>> https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html
> >>>
> >>> Mark
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>
> >>>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Regarding Tomcat url redirection

2024-04-18 Thread Christopher Schultz

Ammu,

On 4/18/24 07:45, lavanya tech wrote:

I added classname rewrite valeus in contex.xml file .

 
 
 

created rewrite.config so both of them is located under  conf under
apache-tomcat.


 https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat . I placed and restarted tomcat webserver but still it
doesnot redirect.


Can you give full paths to both server.xml and rewrite.config, re-post 
your current server.xml  element, and the complete contents of 
rewrite.config?


Have you looked at the log files after start?

-chris


On Thu, Apr 18, 2024 at 1:36 PM lavanya tech 
wrote:


Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .

 
 
 

created rewrite.config so both of them is located under  conf under
apache-tomcat.

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat

Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:


On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to redirect url
from https://example.com to https://www.servercom: and for this i
modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please

suggest.

The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.


autoDeploy="true">

  
  example.com
  
  
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

  
  
  
  example.com
  
className="org.apache.catalina.valves.rewrite.RewriteValve"/>

  
  
  
  example.com
  
  https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write rules in a
Host element (or any other element)?


  
  
  
  



You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-18 Thread lavanya tech
Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .





created rewrite.config so both of them is located under  conf under
apache-tomcat.


https://www.example.com:/example [R=301,L]

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat . I placed and restarted tomcat webserver but still it
doesnot redirect.


Thnks,
Ammu

On Thu, Apr 18, 2024 at 1:36 PM lavanya tech 
wrote:

> Hi Thomas,
>
> Thanks for the fast response.
>
> I added classname rewrite valeus in contex.xml file .
>
> 
> 
> 
>
> created rewrite.config so both of them is located under  conf under
> apache-tomcat.
>
> So according to the documentaion they say context.xml should be placed
> under webapps and rewrite.config file should be put in WEB-INF folder of
> apache-tomcat
>
> Thnks,
> Ammu
>
>
>
> On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:
>
>> On 18/04/2024 12:05, lavanya tech wrote:
>> > Hi Team,
>> >
>> > I am using "Tomcat 10.1" in our environment and I wanted to redirect url
>> > from https://example.com to https://www.servercom: and for this i
>> > modified the server.xml as below in tomcat config, and the below
>> > configuration doesnot seems to work. Does anyone has ideas. Please
>> suggest.
>> > The url alone https://www.servercom:/ already works. But just
>> > redirection from the old to one doesnot.
>> >
>> > > autoDeploy="true">
>> >  
>> >  example.com
>> >  
>> >  > className="org.apache.catalina.valves.rewrite.RewriteValve"/>
>> >  
>> >  > > autoDeploy="true">
>> >  
>> >  example.com
>> >  > className="org.apache.catalina.valves.rewrite.RewriteValve"/>
>> >  
>> >  > > unpackWARs="true" autoDeploy="true">
>> >  
>> >  example.com
>> >  
>> >  > >  > > https://www.servercom:/example/$1 [R=301,L]
>>
>> 1. That isn't valid XML.
>>
>> 2. Where in the Tomcat docs does it say you can nest re-write rules in a
>> Host element (or any other element)?
>>
>> >  
>> >  
>> >  
>> >  
>> > 
>>
>> You need to configure the RewriteValve.
>> https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>


Re: Regarding Tomcat url redirection

2024-04-18 Thread lavanya tech
Hi Thomas,

Thanks for the fast response.

I added classname rewrite valeus in contex.xml file .





created rewrite.config so both of them is located under  conf under
apache-tomcat.

So according to the documentaion they say context.xml should be placed
under webapps and rewrite.config file should be put in WEB-INF folder of
apache-tomcat

Thnks,
Ammu



On Thu, Apr 18, 2024 at 1:22 PM Mark Thomas  wrote:

> On 18/04/2024 12:05, lavanya tech wrote:
> > Hi Team,
> >
> > I am using "Tomcat 10.1" in our environment and I wanted to redirect url
> > from https://example.com to https://www.servercom: and for this i
> > modified the server.xml as below in tomcat config, and the below
> > configuration doesnot seems to work. Does anyone has ideas. Please
> suggest.
> > The url alone https://www.servercom:/ already works. But just
> > redirection from the old to one doesnot.
> >
> >  autoDeploy="true">
> >  
> >  example.com
> >  
> >  
> >  
> >   > autoDeploy="true">
> >  
> >  example.com
> >   className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >  
> >   > unpackWARs="true" autoDeploy="true">
> >  
> >  example.com
> >  
> >   >   > https://www.servercom:/example/$1 [R=301,L]
>
> 1. That isn't valid XML.
>
> 2. Where in the Tomcat docs does it say you can nest re-write rules in a
> Host element (or any other element)?
>
> >  
> >  
> >  
> >  
> > 
>
> You need to configure the RewriteValve.
> https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Regarding Tomcat url redirection

2024-04-18 Thread Mark Thomas

On 18/04/2024 12:05, lavanya tech wrote:

Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to redirect url
from https://example.com to https://www.servercom: and for this i
modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please suggest.
The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.


 
 example.com
 
 
 
 
 
 example.com
 
 
 
 
 example.com
 
 https://www.servercom:/example/$1 [R=301,L]


1. That isn't valid XML.

2. Where in the Tomcat docs does it say you can nest re-write rules in a 
Host element (or any other element)?



 
 
 
 



You need to configure the RewriteValve.
https://tomcat.apache.org/tomcat-10.1-doc/rewrite.html

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Regarding Tomcat url redirection

2024-04-18 Thread lavanya tech
Hi Team,

I am using "Tomcat 10.1" in our environment and I wanted to redirect url
from https://example.com to https://www.servercom: and for this i
modified the server.xml as below in tomcat config, and the below
configuration doesnot seems to work. Does anyone has ideas. Please suggest.
The url alone https://www.servercom:/ already works. But just
redirection from the old to one doesnot.



example.com





example.com




example.com

https://www.servercom:/example/$1 [R=301,L]








Thanks,
Ammu


Re: Which Connector properties will be used in case of redirection?

2018-01-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Suvendu,

On 1/18/18 2:55 AM, Suvendu Sekhar Mondal wrote:
> Hi Christopher,
> 
> On Wed, Jan 17, 2018 at 10:41 PM, Christopher Schultz 
>  wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
>> 
>> Suvendu,
>> 
>> Which version of Tomcat?
>> 
> 
> Tomcat version is 7.0.55
> 
>> On 1/17/18 8:20 AM, Suvendu Sekhar Mondal wrote:
>>> I am seeing one issue. Under high load sporadically one web 
>>> service call fails with: "java.net.SocketTimeoutException:
>>> Read timed out" after 60 Sec mark.
>>> 
>>> In our app, httpd routes requests to  then it get
>>> redirected to 8889.
>> 
>> Can you be very explicit about what you mean by "redirect",
>> here?
> 
> I was talking about auto redirection from  to 8889 by
> Catalina.
> 
>>> Connector which listens on  has connectionTimeout=2 but
>>> the one which listens to 8889 does not have any
>>> connectionTimeout set explicitly. As per doc, default
>>> connectionTimeout value 60 Sec will be set for connector which
>>> listens on 8889 - and that is playing a role here. Do you think
>>> this assumption is correct?
>>> 
>>> Here are the connector properties: >> protocol="HTTP/1.1" connectionTimeout="2"
>>> redirectPort="8889" />
>> 
>> So you are probably expecting that all HTTP traffic to : will
>> be redirected to HTTPS over :8889?
>> 
> 
> Yes.
> 
>> How long does the redirect take?
>> 
> 
> I do not know how to measure redirection time. Please let me know
> if there any mechanism to trace it.
> 
>> Under heavy load, you might be running out of threads depending
>> upon a lot of factors, such as what kind of protocol and endpoint
>> are actually being used. It looks like you are using the APR
>> connector (due to SSLCertificateFile) which has some positive
>> attributes with request to scalability while NIO would probably
>> be the best choice if possible.
>> 
>> It's got terrible performance, though, unless you use the
>> OpenSSL provider (which requires Tomcat 8.5 or later).
>> 
>>> >> SSLCertificateKeyFile="C:\mykey.key" SSLEnabled="true" 
>>> acceptCount="100" clientAuth="false"
>>> disableUploadTimeout="true" enableLookups="false"
>>> keystoreFile="conf/.keystore" maxHttpHeaderSize="8192"
>>> maxSavePostSize="-1" maxThreads="200" minSpareThreads="20"
>>> protocol="HTTP/1.1" scheme="https" secure="true"
>>> sslProtocol="TLS1.2" 
>>> compressableMimeTypes="text/html,text/xml,text/plain,application/jso
n"
>>>
>>>
>>
>>> 
compressionMinSize="2048"
>>> compression="force" threadPriority="6" />
>> 
>> When you say "high load", what kind of load are you talking
>> about, specifically?
>> 
>> You may simply have too much traffic for your existing hardware
>> to handle. No amount of configuration can fix that. - -chris
> 
> We have 9 JVMs. As per current setting, per JVM max concurrency
> can reach up-to 300(maxThreads="200"+acceptCount="100"). Issue was 
> reported when 2300 users on the system.

So that's 2300 users across all 9 JVMs with the same configuration?
Your cluster ought to be able to support 9 * 200 = 1800 simultaneous
active users plus 9 * 100 = 900 queued in the OS's TCP wait queue.
2300 should be within your capabilities, but it might depend heavily
upon how the load-balancer decided to allocate requests. If it sent
all the users to the same node in the cluster, then you'll see bad
performance even if you "should" be able to handle that much load.

Where is the SocketTimeoutException being thrown? On the server, or on
the client? If it's on the server, then it's the client's fault (or
the load-balancer's fault) and it's not a problem at all with your
server capacity.

If it's happening on the client, it makes a lot more sense that the
server might be overloaded. But that 60-second timeout would have to
be on the client, not on the server side. So I'm a little confused as
to what is going on, here.

> So, I think it is not a case of thread exhaustion but something
> else. Most possibly few JVMs were under stress due to uneven load 
> balancing(we have stickysession). This issue just came to me and
> all resource usage data a

Re: Which Connector properties will be used in case of redirection?

2018-01-17 Thread Suvendu Sekhar Mondal
Hi Christopher,

On Wed, Jan 17, 2018 at 10:41 PM, Christopher Schultz
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Suvendu,
>
> Which version of Tomcat?
>

Tomcat version is 7.0.55

> On 1/17/18 8:20 AM, Suvendu Sekhar Mondal wrote:
>> I am seeing one issue. Under high load sporadically one web
>> service call fails with: "java.net.SocketTimeoutException: Read
>> timed out" after 60 Sec mark.
>>
>> In our app, httpd routes requests to  then it get redirected
>> to 8889.
>
> Can you be very explicit about what you mean by "redirect", here?

I was talking about auto redirection from  to 8889 by Catalina.

>> Connector which listens on  has connectionTimeout=2 but the
>> one which listens to 8889 does not have any connectionTimeout set
>> explicitly. As per doc, default connectionTimeout value 60 Sec will
>> be set for connector which listens on 8889 - and that is playing a
>> role here. Do you think this assumption is correct?
>>
>> Here are the connector properties: > protocol="HTTP/1.1" connectionTimeout="2" redirectPort="8889"
>> />
>
> So you are probably expecting that all HTTP traffic to : will be
> redirected to HTTPS over :8889?
>

Yes.

> How long does the redirect take?
>

I do not know how to measure redirection time. Please let me know if
there any mechanism to trace it.

> Under heavy load, you might be running out of threads depending upon a
> lot of factors, such as what kind of protocol and endpoint are
> actually being used. It looks like you are using the APR connector
> (due to SSLCertificateFile) which has some positive attributes with
> request to scalability while NIO would probably be the best choice if
> possible.
>
> It's got terrible performance, though, unless you use the OpenSSL
> provider (which requires Tomcat 8.5 or later).
>
>> > SSLCertificateKeyFile="C:\mykey.key" SSLEnabled="true"
>> acceptCount="100" clientAuth="false" disableUploadTimeout="true"
>> enableLookups="false" keystoreFile="conf/.keystore"
>> maxHttpHeaderSize="8192" maxSavePostSize="-1" maxThreads="200"
>> minSpareThreads="20" protocol="HTTP/1.1" scheme="https"
>> secure="true" sslProtocol="TLS1.2"
>> compressableMimeTypes="text/html,text/xml,text/plain,application/json"
>>
>>
> compressionMinSize="2048"
>> compression="force" threadPriority="6" />
>
> When you say "high load", what kind of load are you talking about,
> specifically?
>
> You may simply have too much traffic for your existing hardware to
> handle. No amount of configuration can fix that.
> - -chris

We have 9 JVMs. As per current setting, per JVM max concurrency can
reach up-to 300(maxThreads="200"+acceptCount="100"). Issue was
reported when 2300 users on the system. So, I think it is not a case
of thread exhaustion but something else. Most possibly few JVMs were
under stress due to uneven load balancing(we have stickysession). This
issue just came to me and all resource usage data are gone. I have
asked for re-run so that I can analyze it properly. Let's see. :)

Back to my original question, in case of HTTP to HTTPS auto
redirection, Connector properties set for the later will be finally
applied to the request - is that a correct statement?

Thanks!
Suvendu

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Which Connector properties will be used in case of redirection?

2018-01-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Suvendu,

Which version of Tomcat?

On 1/17/18 8:20 AM, Suvendu Sekhar Mondal wrote:
> I am seeing one issue. Under high load sporadically one web
> service call fails with: "java.net.SocketTimeoutException: Read
> timed out" after 60 Sec mark.
> 
> In our app, httpd routes requests to  then it get redirected
> to 8889.

Can you be very explicit about what you mean by "redirect", here?

> Connector which listens on  has connectionTimeout=2 but the
> one which listens to 8889 does not have any connectionTimeout set 
> explicitly. As per doc, default connectionTimeout value 60 Sec will
> be set for connector which listens on 8889 - and that is playing a
> role here. Do you think this assumption is correct?
> 
> Here are the connector properties:  protocol="HTTP/1.1" connectionTimeout="2" redirectPort="8889"
> />

So you are probably expecting that all HTTP traffic to : will be
redirected to HTTPS over :8889?

How long does the redirect take?

Under heavy load, you might be running out of threads depending upon a
lot of factors, such as what kind of protocol and endpoint are
actually being used. It looks like you are using the APR connector
(due to SSLCertificateFile) which has some positive attributes with
request to scalability while NIO would probably be the best choice if
possible.

It's got terrible performance, though, unless you use the OpenSSL
provider (which requires Tomcat 8.5 or later).

>  SSLCertificateKeyFile="C:\mykey.key" SSLEnabled="true" 
> acceptCount="100" clientAuth="false" disableUploadTimeout="true" 
> enableLookups="false" keystoreFile="conf/.keystore" 
> maxHttpHeaderSize="8192" maxSavePostSize="-1" maxThreads="200" 
> minSpareThreads="20" protocol="HTTP/1.1" scheme="https" 
> secure="true" sslProtocol="TLS1.2" 
> compressableMimeTypes="text/html,text/xml,text/plain,application/json"
>
> 
compressionMinSize="2048"
> compression="force" threadPriority="6" />

When you say "high load", what kind of load are you talking about,
specifically?

You may simply have too much traffic for your existing hardware to
handle. No amount of configuration can fix that.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpfg7sdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFj12Q//WlJMd0JpQJVqFt1z
d3aI52pVFQih3Bii8UOAZzZr6omPqqFlkKt2cnAg8lWA3KQaQLJRyzlJKthIzNsB
12nMQlbQzCJZqn1IzggxtEWNL8KDVFY3fo2heJLrEANrIcXx+C6MAb1FLTeZ2/XP
V9R1u5q8mOdVgPyj4vITIsjn0oaa4pZ/ypkYwRATT9BRBy8rxkzVneDKPo8ILfdZ
Cp1Says1JD4uIEJn9VUlITOC1/08XyeHtrZXR3j3w9A07x9mLdHjVi6yxyyGcMoz
u0X/bt1E+Q6LkfTaQ64ubh2dbPXW4JgQy8I43Qzbxytwc2SdB691Un8lAhdnxaIk
zBioeiR4Kp+ATOuwbSPqJZ8n15pJENp95KvtR7B+xKn2klKMhuXHMb98OwdL7XBu
AeoGW1+RNpEwq1A8l4XmrmvFmrkqKTJVM8kxrPM3lTpTuQcvEtKk0OHOqlD10TGm
ldxP61qBLPK1ekjF/8CWxCO011wIvCoWySI8FDLOeXAo8F0ueBA0okajB2+9usqK
KpMckGQuRsoC6yVKMAz+ej3UCMiqQPSuuK06Pv8UrI7qTRGqRkBtVcSOIucXKC0S
6QrB4Mm6HajD7+d2/bOd4lJGRSSx3IoWNRx62Hthu9H2MTpp1/EWTwc5aesq2Zmo
OVsym/pIs8akxDw3Fkux5Imwr40=
=DLo7
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Which Connector properties will be used in case of redirection?

2018-01-17 Thread Suvendu Sekhar Mondal
Hello Everyone,

I am seeing one issue. Under high load sporadically one web service
call fails with: "java.net.SocketTimeoutException: Read timed out"
after 60 Sec mark.

In our app, httpd routes requests to  then it get redirected to
8889. Connector which listens on  has connectionTimeout=2 but
the one which listens to 8889 does not have any connectionTimeout set
explicitly. As per doc, default connectionTimeout value 60 Sec will be
set for connector which listens on 8889 - and that is playing a role
here. Do you think this assumption is correct?

Here are the connector properties:




Thanks!
Suvendu

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Redirection/URL rewriting Tomcat 8.5.14

2017-05-12 Thread Daniel Savard
Hi Chris,

2017-05-12 13:31 GMT-04:00 Christopher Schultz :

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Daniel,
>
> On 5/12/17 10:03 AM, Daniel Savard wrote:
> > Hi everyone,
> >
> > my question is not specific to the Tomcat version specified in the
> > subject line. I am trying to implement a URL rewrite or
> > redirection using Tomcat. What I want to do is the following:
> >
> > In a given instance of Tomcat, I have each application context
> > setup using the xml files in
> > $CATALINA_BASE/conf/[enginename]/[hostname]/, so far so good. Hence
> > for app1 I then have the URL:
> https://myserver:myport/app1, etc.
> >
> > What I need to do, is to have a dummy application which purpose is
> > just to redirect/rewrite the URL from one application to another.
> > So, I need in fact an empty application capturing each request and
> > send back to the browser a rewritten URL to the another
> > application.
> >
> > For example, suppose I want to redirect app1 to app2, I need to
> rewrite all
> > possible URL with query options and so one replacing only app1 by
> > app2 in the URL.
> >
> > https://myserver:myport/app1/something_more_specific?opt1 should be
> >  rewritten as
> > https://myserver:myport/app2/something_more_specific?opt1
> >
> > To do this, I read about the rewrite valve here:
> > http://tomcat.apache.org/tomcat-8.5-doc/rewrite.html
> >
> > So, I created an empty directory $CATALINA_BASE/webapps/app1 with
> > the following file:
> >
> > $CATALINA_BASE/webapps/app1/WEB-INF/rewrite.config
> >
> > And my $CATALINA_BASE/conf/[enginename]/[hostname]/app1.xml has the
> >  following entry within its context:
> >
> >  > className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> >
> > My rewrite.config file is as follow:
> >
> > RewriteCond %{REQUEST_URI} ^/app1/?.* RewriteRule ^/app1(/?.*)$
> > /app2$1 [L]
> >
> > Without anything else, I am getting a HTTP 404 code. With an empty
> >  index.html I am getting a blank page. Within a working application
> > I am getting the application's welcome page. But never the URL is
> rewritten. The
> > rewrite.config file is actually read, I checked by introducing
> > some typo and I am getting an error message at startup.
> >
> > Is there a way to debug this problem? How can I see what is going
> > on with the execution of the rewriting class?
>
> I think everything you have above is correct, except that you want to
> deploy everything in the ROOT application instead of into "app1". With
> "app1", you are re-writing "/app1/app1" to "/app1/app2" when in fact you
> want to rewrite "/app1" to "/app2", correct?
>
> Also, it's important that /app1 not be a deployed application, otherwise
> requests to that context path with be sent to the /app1 application
> instead of to the ROOT webapp.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJZFfGGAAoJEBzwKT+lPKRYlfsQAK9+rFzKtrrPS73Ma9VDclkn
> Lr3oG65TdKPhwVEtQlQoxLggX3GLiepImPzjY52rnMhxCZj+tt5n/fCkqVzEPnIp
> /NNgz/nX/GWqYjU11V58Azh2GRrjBqCJmesawxB/Y5+2NjcW6PrXJNje5PBmkbjs
> QkI5ftAYih7zxWQ4yASJfYwOmmjPpdNfyEM0IR/qkh/VnTz5bVu0/EgeOOK0/Dny
> EsK+3ptm+gdTNVt9jqwEnhWx5tsgpanhTycyyagwROT2A7NaldIi7xARPW3ZlSSF
> 0ncvQ8Z3G0KolBsGsDVyNgNv+bF38sfxOaN7xyp9GXFJVX5hKfRFBphiWPl+jjzz
> mwPcA3MsqDM3fQ4hMTAffmnUAj786pTZ6MCjDnumFjnQZB0zXASEpfI4G9f3+dKM
> fiVdjUQxgrXlUl6wcqBGUidN5PDb+akY8w9xNDl3PvBjrXfFIIfttLgGmxF5cej6
> dkvLqZoitIDzt8dOkWSns3UdK+fq3a1Hjw1BOPlvnvKbnhz2QXrxua6WMDQapohs
> JUUkAR3sujPUs/Tgjq5SiIEBe9sbwQTysNgtw9MzFUmAB7D87cCt0zI8dCbaL54Z
> iYUI0+IDVG7rc7+TwFeRo+ok96qMK1IKCiZt/8pe/097WcWMQq9FeYpGAg4YgZYo
> bwhJFBohEZeuwZCwhN9F
> =J7pC
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
Thanks for the tip. I am almost there. Actually, moving everything in ROOT
solved at least the actual execution of the rewriting. However, it didn't
solve entirely my problem.

If I access the URL: https://myhost/app1 in my browser the URL is actually
rewritten to https://myhost/app2 and access the index.html, etc. This is
fine.

However, if I try to access the URL: https://myhost/app1/ in my browser the
URL is NOT rewritten even if the actual application is properly accessed. I
really need the URL to be sent back 

Re: Redirection/URL rewriting Tomcat 8.5.14

2017-05-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Daniel,

On 5/12/17 10:03 AM, Daniel Savard wrote:
> Hi everyone,
> 
> my question is not specific to the Tomcat version specified in the 
> subject line. I am trying to implement a URL rewrite or
> redirection using Tomcat. What I want to do is the following:
> 
> In a given instance of Tomcat, I have each application context
> setup using the xml files in
> $CATALINA_BASE/conf/[enginename]/[hostname]/, so far so good. Hence
> for app1 I then have the URL:
https://myserver:myport/app1, etc.
> 
> What I need to do, is to have a dummy application which purpose is 
> just to redirect/rewrite the URL from one application to another.
> So, I need in fact an empty application capturing each request and
> send back to the browser a rewritten URL to the another
> application.
> 
> For example, suppose I want to redirect app1 to app2, I need to
rewrite all
> possible URL with query options and so one replacing only app1 by 
> app2 in the URL.
> 
> https://myserver:myport/app1/something_more_specific?opt1 should be
>  rewritten as 
> https://myserver:myport/app2/something_more_specific?opt1
> 
> To do this, I read about the rewrite valve here: 
> http://tomcat.apache.org/tomcat-8.5-doc/rewrite.html
> 
> So, I created an empty directory $CATALINA_BASE/webapps/app1 with 
> the following file:
> 
> $CATALINA_BASE/webapps/app1/WEB-INF/rewrite.config
> 
> And my $CATALINA_BASE/conf/[enginename]/[hostname]/app1.xml has the
>  following entry within its context:
> 
>  className="org.apache.catalina.valves.rewrite.RewriteValve"/>
> 
> My rewrite.config file is as follow:
> 
> RewriteCond %{REQUEST_URI} ^/app1/?.* RewriteRule ^/app1(/?.*)$ 
> /app2$1 [L]
> 
> Without anything else, I am getting a HTTP 404 code. With an empty
>  index.html I am getting a blank page. Within a working application
> I am getting the application's welcome page. But never the URL is
rewritten. The
> rewrite.config file is actually read, I checked by introducing
> some typo and I am getting an error message at startup.
> 
> Is there a way to debug this problem? How can I see what is going
> on with the execution of the rewriting class?

I think everything you have above is correct, except that you want to
deploy everything in the ROOT application instead of into "app1". With
"app1", you are re-writing "/app1/app1" to "/app1/app2" when in fact you
want to rewrite "/app1" to "/app2", correct?

Also, it's important that /app1 not be a deployed application, otherwise
requests to that context path with be sent to the /app1 application
instead of to the ROOT webapp.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJZFfGGAAoJEBzwKT+lPKRYlfsQAK9+rFzKtrrPS73Ma9VDclkn
Lr3oG65TdKPhwVEtQlQoxLggX3GLiepImPzjY52rnMhxCZj+tt5n/fCkqVzEPnIp
/NNgz/nX/GWqYjU11V58Azh2GRrjBqCJmesawxB/Y5+2NjcW6PrXJNje5PBmkbjs
QkI5ftAYih7zxWQ4yASJfYwOmmjPpdNfyEM0IR/qkh/VnTz5bVu0/EgeOOK0/Dny
EsK+3ptm+gdTNVt9jqwEnhWx5tsgpanhTycyyagwROT2A7NaldIi7xARPW3ZlSSF
0ncvQ8Z3G0KolBsGsDVyNgNv+bF38sfxOaN7xyp9GXFJVX5hKfRFBphiWPl+jjzz
mwPcA3MsqDM3fQ4hMTAffmnUAj786pTZ6MCjDnumFjnQZB0zXASEpfI4G9f3+dKM
fiVdjUQxgrXlUl6wcqBGUidN5PDb+akY8w9xNDl3PvBjrXfFIIfttLgGmxF5cej6
dkvLqZoitIDzt8dOkWSns3UdK+fq3a1Hjw1BOPlvnvKbnhz2QXrxua6WMDQapohs
JUUkAR3sujPUs/Tgjq5SiIEBe9sbwQTysNgtw9MzFUmAB7D87cCt0zI8dCbaL54Z
iYUI0+IDVG7rc7+TwFeRo+ok96qMK1IKCiZt/8pe/097WcWMQq9FeYpGAg4YgZYo
bwhJFBohEZeuwZCwhN9F
=J7pC
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Redirection/URL rewriting Tomcat 8.5.14

2017-05-12 Thread Daniel Savard
Hi everyone,

my question is not specific to the Tomcat version specified in the subject
line. I am trying to implement a URL rewrite or redirection using Tomcat.
What I want to do is the following:

In a given instance of Tomcat, I have each application context setup using
the xml files in $CATALINA_BASE/conf/[enginename]/[hostname]/, so far so
good. Hence for app1 I then have the URL: https://myserver:myport/app1, etc.

What I need to do, is to have a dummy application which purpose is just to
redirect/rewrite the URL from one application to another. So, I need in
fact an empty application capturing each request and send back to the
browser a rewritten URL to the another application.

For example, suppose I want to redirect app1 to app2, I need to rewrite all
possible URL with query options and so one replacing only app1 by app2 in
the URL.

https://myserver:myport/app1/something_more_specific?opt1 should be
rewritten as https://myserver:myport/app2/something_more_specific?opt1

To do this, I read about the rewrite valve here:
http://tomcat.apache.org/tomcat-8.5-doc/rewrite.html

So, I created an empty directory $CATALINA_BASE/webapps/app1 with the
following file:

$CATALINA_BASE/webapps/app1/WEB-INF/rewrite.config

And my $CATALINA_BASE/conf/[enginename]/[hostname]/app1.xml has the
following entry within its context:



My rewrite.config file is as follow:

RewriteCond %{REQUEST_URI} ^/app1/?.*
RewriteRule ^/app1(/?.*)$ /app2$1 [L]

Without anything else, I am getting a HTTP 404 code. With an empty
index.html I am getting a blank page. Within a working application I am
getting the application's welcome page. But never the URL is rewritten. The
rewrite.config file is actually read, I checked by introducing some typo
and I am getting an error message at startup.

Is there a way to debug this problem? How can I see what is going on with
the execution of the rewriting class?

Regards,
-
Daniel Savard


Re: tomcat 7.0.70 redirection is not working as expected with https

2016-09-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Manish,

On 9/9/16 2:47 AM, Palod, Manish wrote:
> Hi All, Previously I was using apache web server and tomcat for SSL
> redirection and web server, in that case redirection from apache to
> tomcat was working fine.
> 
> Now I have removed the apache web server and using tomcat only for
> ssl settings also [server.xml sslEnabled and other related
> settings], things are in general working fine, in one case
> redirection is not happening properly.
> 
> Following are the details about my server.xml =  port="80" address="" protocol="HTTP/1.1" 
> connectionTimeout="2" maxPostSize="10485760" redirectPort="444"
> URIEncoding="UTF-8"/>
> 
>   SSLEnabled="true" maxThreads="150" scheme="https" secure="true" 
> keystoreFile="conf/my-server.keystore" keystorePass=""
> keystoreType="jks" compression="on"
> compressableMimeType="text/html,text/xml,text/plain,text/javascript,te
xt/css,application/x-javascript,application/javascript"
>
> 
address=""
> ciphers="" clientAuth="false" sslProtocol="TLS" 
> sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" redirectPort="444"
> maxPostSize="10485760"/>
> 
>  maxThreads="150" scheme="https" secure="true" 
> keystoreFile="conf/my-server.keystore" keystorePass=""
> keystoreType="jks" compression="on"
> compressableMimeType="text/html,text/xml,text/plain,text/javascript,te
xt/css,application/x-javascript,application/javascript"
>
> 
address=""
> truststoreFile="conf/ca.keystore" truststorePass=""
> truststoreType="jks" clientAuth="true" sslProtocol="TLS" 
> sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" ciphers="" 
> redirectPort="443"  maxPostSize="10485760"/> =
> 
> When I type, http://http://%3cIP-Address>>, I am able
> to access the server and able to perform the client-auth and
> server-auth operation
> 
> But when we try, https://https://%3cIP-Address>>, it
> fails

What version of Tomcat?

Please post the full Tomcat startup log from catalina.out. No
particular applications need to be deployed -- just let Tomcat start
on its own and post the log.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJX0wFfAAoJEBzwKT+lPKRYPXcP/RHRSd9rriZMH835rYYYtQK5
b4Ia+pLzH70YoatDeghwkbZYnVKk18gVq7PBGgID9WnP2aUtM1i1sMG5TpALy4Mz
6wnrwZTxtQgNyBMTe0G3QPc3k9YXmuScldi7LOaIoWVfVRONWJ3jP3LlBmAdaXGL
/QpyQG7CPd9CHiaYcKoh46oWVpknJ42NEFlMcpspD53bTgerTbIt5Q/ps5Y9FW8s
Znwb/zz7OIibzy/8C8hWZ0ycXYQzTNEfXxupI7DFJ5sUe2qLON9heeDKII69MVdi
XBsjhFW6DozN6CYXzSpzir574Us8pWXuMbGtGADIfy+xRpM8ISWqwDYB2XKgUuEc
bf5Mi6chxTGgKXowKdVpQskPOwlWOudDe58B4guYzCCpCGBX0vL4OJgNiDa+OkQk
uIOK8VDWPaWLs/cMjbj3uehr2KXCaH3UVDETILtq3BdMP3Vhvezbpmmyc2ubtyhn
gBr43fY3C7E7nUIlLixgh+yT9z9DUUUz7HKgWs42mTWyW5miH/NrR5S+tP+AQU8Z
EYxFyE8k1i3ccrdUa9cO0j/PJrsXLT7o5dF43CAWmgMgbFy82jdeX/HLvb3hGLmD
lsJdBuZ7g49k2+e/vKRew2kpYquAJ9BOQY4jzRnc0Ki1pxLj/z3DV5rdujNBQV4z
jGNiY+1ZuxTR89sR1zmL
=5rGv
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



tomcat 7.0.70 redirection is not working as expected with https

2016-09-08 Thread Palod, Manish
Hi All,
Previously I was using apache web server and tomcat for SSL redirection and web 
server, in that case redirection from apache to tomcat was working fine.

Now I have removed the apache web server and using tomcat only for ssl settings 
also [server.xml sslEnabled and other related settings], things are in general 
working fine, in one case redirection is not happening properly.

Following are the details about my server.xml
=
  

  
  


=

When I type,
http://http://%3cIP-Address>>, I am able to access the server and 
able to perform the client-auth and server-auth operation

But when we try,
https://https://%3cIP-Address>>, it fails


please help.


Regards
Manish



Certificate installation for https causing redirection.

2016-04-14 Thread Weare Borg
Hello friends,

Sorry for pushing the question to both Tomcat and Apache, as changes seem
to be required in both Apache and Tomcat, so I did that.

We have one test server with Debian X64 which has one web-project running
in Apache and few webapps running with Apache Tomcat. The Apache web-server
runs mod_proxy and redirecting requests to Tomcat whenever the URL is
correct.

For adding security, I created certificates with LetsEncrypt
 and installed them. Unfortunately, for one of
the webapp which I installed the certificate, it is not opening anymore,
and whenever I try to open that webapp in browser, it redirects to the
web-project running in Apache web server. What am I doing wrong?

Please note, I was provided with .pem files, and had to convert them to .crt
and .key. Unfortunately there are no errors in logs as well. Right now, I
cannot reach the tomcat webapp which I would like with https.

Here is the configuration :

sites-enabled/000-default :

> 
> ServerAdmin webmaster@localhost
> ServerName www.apache_domain.com
> ServerAlias apache_domain.com
> DocumentRoot /var/www
> 
> Options FollowSymLinks
> AllowOverride None
> 
> 
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
>  Order allow,deny
> allow from all
> 
>
> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
> 
> AllowOverride None
> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> Order allow,deny
> Allow from all
> 
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> Listen 443ServerName www.tomcat_domain.deServerAlias 
> tomcat_domain.deSSLEngine onSSLCertificateFile 
> /etc/letsencrypt/live/www.tomcat_domain.de/tool.crtSSLCertificateKeyFile 
> /etc/letsencrypt/live/www.tomcat_domain.de/private.keyProxyRequests 
> offProxyPreserveHost OnOrder deny,allowAllow from 
> all#ProxyPass /maintenance.html !#ProxyPass / 
> http://localhost:8080/#ProxyPassReverse / http://localhost:8080/
> Order allow,denyAllow from all
>
>
Tomcat server.xml :

>  protocol="org.apache.coyote.http11.Http11NioProtocol" compression="force" 
> compressionMinSiz$
>connectionTimeout="2"  maxPostSize="5242880"
>URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/ 
> javascript,application/x-javascript,application/javascript"/>
>
>
>
>maxPostSize="5242880" SSLEnabled="true" maxThreads=$
>   compressionMinSize="1024" scheme="https" secure="true" 
> clientAuth="false" sslProtocols="TLS"
> sslEnabledProtocols="TLSv1+TLSv1.1+TLSv1.2"
>
> SSLCertificateFile="/etc/letsencrypt/live/www.tool-tank.de/tool.crt"
> 
> SSLCertificateKeyFile="/etc/letsencrypt/live/www.tool-tank.de/privkey.pem"
>  URIEncoding="utf-8"
>  compressableMimeType="text/html,text/xml,text/plain,text/css,text/ 
> javascript,application/x-javascript,application/javascript"/>
>
>   autoDeploy="true"/>
>
>
>
>  appBase="tomcat_domain_webapps">
> www.tomcat_domain.de
> 
> 
>
>  appBase="second_webapps">
> www.second.com
> 
> 
>
>  appBase="third_webapps">
> www.third.de
> 
> 
>
>  appBase="fourth_webapps">
> fourth.de
> 
> 
>
> Any help would be nice.


Re: URL based redirection working partially with Apache tomcat

2015-12-07 Thread Kernel freak
Hi Chris,

I was able to finally resolve it by adding Host elements directly in
server.xml and creating separate webapps folder for each app to hold the
WAR file. I am on to a bigger fish. I will post a question soon in mailing
list. Thank you.

On Thu, Dec 3, 2015 at 6:37 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> To whom it may concern,
>
> On 12/3/15 10:54 AM, Kernel freak wrote:
> > Hello friends,
> >
> > I would like to deploy multiple webapps(as of now 2,waiting for domain
> name
> > for 3rd) on a single Apache Tomcat instance. I have been partially
> > successful as one URL is working properly, other is not.
> >
> > Situation :
> > 1) I have created two folders called domain1_webapps  and domain2_webapps
> > and put the respective webapps named ROOT.war in each of them.
> > 2) Then I configured server.xml as mentioned below.
> >
> >
> >   > autoDeploy="true"/>
> >  unpackWARs="true"
> > appBase="domain1_webapps"/>
> >  unpackWARs="true"
> > appBase="domain2_webapps"/>
> >
> > Right now when I call www.domain-one.com( not domain-one.com), I get the
> > correct site. But for the 2nd one, I have to call
> > www.domain-two.com/app_name.
> >
> > *How can I remove in 2nd domain the app_name context-path which is
> getting
> > appended. Kindly let me know. *
> >
> > The ironical situation is I have not kept the app_name anywhere, guess
> > Tomcat must be retrieving it from POM.xml.
> >
> > Reference question on SO :
> >
> http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works
>
> Have you read the documentation for how to deploy a web application in
> Tomcat?
>
>
> http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Defining_a_context
>
> -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: URL based redirection working partially with Apache tomcat

2015-12-03 Thread Christopher Schultz
To whom it may concern,

On 12/3/15 10:54 AM, Kernel freak wrote:
> Hello friends,
> 
> I would like to deploy multiple webapps(as of now 2,waiting for domain name
> for 3rd) on a single Apache Tomcat instance. I have been partially
> successful as one URL is working properly, other is not.
> 
> Situation :
> 1) I have created two folders called domain1_webapps  and domain2_webapps
> and put the respective webapps named ROOT.war in each of them.
> 2) Then I configured server.xml as mentioned below.
> 
> 
>   autoDeploy="true"/>
>  appBase="domain1_webapps"/>
>  appBase="domain2_webapps"/>
> 
> Right now when I call www.domain-one.com( not domain-one.com), I get the
> correct site. But for the 2nd one, I have to call
> www.domain-two.com/app_name.
> 
> *How can I remove in 2nd domain the app_name context-path which is getting
> appended. Kindly let me know. *
> 
> The ironical situation is I have not kept the app_name anywhere, guess
> Tomcat must be retrieving it from POM.xml.
> 
> Reference question on SO :
> http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works

Have you read the documentation for how to deploy a web application in
Tomcat?

http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Defining_a_context

-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



URL based redirection working partially with Apache tomcat

2015-12-03 Thread Kernel freak
Hello friends,

I would like to deploy multiple webapps(as of now 2,waiting for domain name
for 3rd) on a single Apache Tomcat instance. I have been partially
successful as one URL is working properly, other is not.

Situation :
1) I have created two folders called domain1_webapps  and domain2_webapps
and put the respective webapps named ROOT.war in each of them.
2) Then I configured server.xml as mentioned below.


 



Right now when I call www.domain-one.com( not domain-one.com), I get the
correct site. But for the 2nd one, I have to call
www.domain-two.com/app_name.

*How can I remove in 2nd domain the app_name context-path which is getting
appended. Kindly let me know. *

The ironical situation is I have not kept the app_name anywhere, guess
Tomcat must be retrieving it from POM.xml.

Reference question on SO :
http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works

Regards,
Kernel


Re: Multiple tomcat instances and redirection of URLs to different ports.

2014-07-18 Thread Daniel Mikusa
On Fri, Jul 18, 2014 at 5:27 AM, Ben Calnan 
wrote:

> Hello everybody,
>
> My question is about multiple tomcat instances and redirection of URLs to
> other ports on IIS6 windows server 2003.
>
> I have two Java apps (web archives) GeoServer and GeoNetwork. Because they
> are quite big memory intensive apps, I've heard it's recommended to run two
> instances of Tomcat.
>
> I've downloaded the windows service installer (32bit, tomcat 8.09) and
> installed two copies of Tomcat with separate ports namely:
>
>
>  *   Instance 1:
> *   HTTP 8083, redirect 8100,
> *   Shutdown port 8005,
> *   AJP 8009, redirect 8100
>  *   Instance 2:
> *   HTTP 8084, redirect 8101
> *   shutdown 8006,
> *   AJP 8010, redirect 8101
>
>
> Everything seems to work correctly if I type in the URL with the port
> number, but site is only available to public users on port 8080.
>
> So my question is how do I redirect users who say type in
> www.example.com/geoserver<http://www.mysite.com/geoserver> to
> www.example.com:8083/geoserver<http://www.mysite.com:8083/geoserver>, or
> www.example.com/geonetwork<http://www.mysite.com/geonetwork> to
> www.example.com:8084/geonetwork<http://www.example.com:8084/geonetwork>
> without them seeing. Do I need some kind of ISAPI filter to do this in IIS6?
>
> Apologies if this is dumb question or the wrong forum, any help though
> would be very much appreciated!
>

One option is to put a reverse proxy in front of your Tomcat instances.
 The reverse proxy, likely IIS in your case, would listen on the standard
ports 80 and 443 taking requests and proxying them to your Tomcat
instances.  Once a request is processed, Tomcat would send the response to
IIS and IIS would return the response to the user.  One of the neat things
about this is that since users only talk to IIS, they don't need to worry
about the port that Tomcat is running on.

There is some documentation on setting this up here:
http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html

Dan


Multiple tomcat instances and redirection of URLs to different ports.

2014-07-18 Thread Ben Calnan
Hello everybody,

My question is about multiple tomcat instances and redirection of URLs to other 
ports on IIS6 windows server 2003.

I have two Java apps (web archives) GeoServer and GeoNetwork. Because they are 
quite big memory intensive apps, I've heard it's recommended to run two 
instances of Tomcat.

I've downloaded the windows service installer (32bit, tomcat 8.09) and 
installed two copies of Tomcat with separate ports namely:


 *   Instance 1:
*   HTTP 8083, redirect 8100,
*   Shutdown port 8005,
*   AJP 8009, redirect 8100
 *   Instance 2:
*   HTTP 8084, redirect 8101
*   shutdown 8006,
*   AJP 8010, redirect 8101


Everything seems to work correctly if I type in the URL with the port number, 
but site is only available to public users on port 8080.

So my question is how do I redirect users who say type in 
www.example.com/geoserver<http://www.mysite.com/geoserver> to 
www.example.com:8083/geoserver<http://www.mysite.com:8083/geoserver>, or 
www.example.com/geonetwork<http://www.mysite.com/geonetwork> to 
www.example.com:8084/geonetwork<http://www.example.com:8084/geonetwork> without 
them seeing. Do I need some kind of ISAPI filter to do this in IIS6?

Apologies if this is dumb question or the wrong forum, any help though would be 
very much appreciated!

Thanks


Hackney Council may exercise its right to intercept any communication, the only 
exception to this would be confidential survey data, with any employee or agent 
of the Council using its telephony or data networks. 
By using these networks you give your consent to Hackney Council monitoring and 
recording your communication.
If you have received this e-mail in error please delete it immediately and 
contact the sender.
For further information about Hackney Council policies please contact Hackney 
Service Centre on: 020 8356 3000


Re: Error redirection settings

2014-02-19 Thread Randeep
On Wed, Feb 19, 2014 at 7:37 PM, André Warnier  wrote:

> Randeep wrote:
>
>> Hi,
>>
>> I'm using tomcat apache-tomcat-6.0.37
>> I have a few web applications in webapps directory.
>>
>> portal
>> sms
>> crm
>>
>> I'm creating custom error pages.
>>
>> inside the webapplication "portal" under WEB-INF in web.xml I have given
>> the following.
>>
>> 
>> 400
>> /lp/404.html
>> 
>> 
>> 404
>> /lp/404.html
>> 
>> 
>> 500
>> /lp/oops.html
>> 
>> 
>> java.lang.Throwable
>> /lp/oops.html
>> 
>>
>> And is working fine for the errors like
>>
>> domain.com/portal/sdgggdhsh
>>
>> But for other web applications, obviously it wont work. because I haven't
>> configured in their web.xml files.
>>
>> Is there any way I can give common error pages?
>> I can see that there is a web.xml file under conf directory. And I have
>> given the settings in it. As below.
>>
>> 
>> 400
>> /404.html
>> 
>> 
>> 404
>> /404.html
>> 
>> 
>> 500
>> /oops.html
>> 
>> 
>> java.lang.Throwable
>> /oops.html
>> 
>>
>> Path I changed. starting from "/" and put the files in webapps directory.
>> But it is not working.
>>
>> How can I do this?
>>
>
> After a search in Google for "tomcat error-page location", I found this :
> http://stackoverflow.com/questions/3856145/empty-page-
> instead-of-custom-tomcat-error-page
>
> which seems to say that Tomcat will always prefix the given 
> with the
> context path of the application where the error happens.
> (For example, if you have /oops.html error happens in your app "/MyApp", then Tomcat will be looking for the
> file ...webapps/MyApp/oops.html).
>
> So you cannot have one "generic" location for these error pages, and share
> them for all applications. You have to add the error page to each deployed
> application, separately.
>
> More precisely : you can *define* the error pages, as you have done, in
> the generic conf/web.xml.  But you still have to put a copy of the pages
> themselves in each application separately.
> I suppose that this obeys the general principle according to which each
> application should be self-contained.
>
> Maybe in later Tomcat versions, there would be a way around this via
> aliases or the likes, but it is probably still not recommended.
>
>
> Note also, separately : the URL path "/" resolves to ".../webapps/ROOT/",
> not to ".../webapps/".
>
> Thank you for the reply Andre. I'll add in all the webapps separately.

> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
Randeep
Mob: +919447831699[kerala]
Mob: +919880050349[B'lore]
I blog here:
http://www.randeeppr.me/
Follow me Here:
http://twitter.com/Randeeppr
Poke me here!
http://www.facebook.com/Randeeppr
A little Linux Help
http://www.linuxhelp.in/
Work profile:
http://in.linkedin.com/in/randeeppr


Re: Error redirection settings

2014-02-19 Thread André Warnier

Randeep wrote:

Hi,

I'm using tomcat apache-tomcat-6.0.37
I have a few web applications in webapps directory.

portal
sms
crm

I'm creating custom error pages.

inside the webapplication "portal" under WEB-INF in web.xml I have given
the following.


400
/lp/404.html


404
/lp/404.html


500
/lp/oops.html


java.lang.Throwable
/lp/oops.html


And is working fine for the errors like

domain.com/portal/sdgggdhsh

But for other web applications, obviously it wont work. because I haven't
configured in their web.xml files.

Is there any way I can give common error pages?
I can see that there is a web.xml file under conf directory. And I have
given the settings in it. As below.


400
/404.html


404
/404.html


500
/oops.html


java.lang.Throwable
/oops.html


Path I changed. starting from "/" and put the files in webapps directory.
But it is not working.

How can I do this?


After a search in Google for "tomcat error-page location", I found this :
http://stackoverflow.com/questions/3856145/empty-page-instead-of-custom-tomcat-error-page

which seems to say that Tomcat will always prefix the given  with the
context path of the application where the error happens.
(For example, if you have /oops.htmlapp "/MyApp", then Tomcat will be looking for the file ...webapps/MyApp/oops.html).


So you cannot have one "generic" location for these error pages, and share them for all 
applications. You have to add the error page to each deployed application, separately.


More precisely : you can *define* the error pages, as you have done, in the generic 
conf/web.xml.  But you still have to put a copy of the pages themselves in each 
application separately.
I suppose that this obeys the general principle according to which each application should 
be self-contained.


Maybe in later Tomcat versions, there would be a way around this via aliases or the likes, 
but it is probably still not recommended.



Note also, separately : the URL path "/" resolves to ".../webapps/ROOT/", not to 
".../webapps/".


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Error redirection settings

2014-02-19 Thread Randeep
Hi,

I'm using tomcat apache-tomcat-6.0.37
I have a few web applications in webapps directory.

portal
sms
crm

I'm creating custom error pages.

inside the webapplication "portal" under WEB-INF in web.xml I have given
the following.


400
/lp/404.html


404
/lp/404.html


500
/lp/oops.html


java.lang.Throwable
/lp/oops.html


And is working fine for the errors like

domain.com/portal/sdgggdhsh

But for other web applications, obviously it wont work. because I haven't
configured in their web.xml files.

Is there any way I can give common error pages?
I can see that there is a web.xml file under conf directory. And I have
given the settings in it. As below.


400
/404.html


404
/404.html


500
/oops.html


java.lang.Throwable
/oops.html


Path I changed. starting from "/" and put the files in webapps directory.
But it is not working.

How can I do this?
-- 
Randeep
Mob: +919447831699[kerala]
Mob: +919880050349[B'lore]
I blog here:
http://www.randeeppr.me/
Follow me Here:
http://twitter.com/Randeeppr
Poke me here!
http://www.facebook.com/Randeeppr
A little Linux Help
http://www.linuxhelp.in/
Work profile:
http://in.linkedin.com/in/randeeppr


RE: Redirection of mycompany.com to www.mycompany.com

2013-12-18 Thread pierre posset
Hi,

I have found what was happening, it was one of my colleagues who has put a 
filter and didin't remember doing that.

Thank you.

> Date: Tue, 17 Dec 2013 00:30:04 +0400
> Subject: Re: Redirection of mycompany.com to www.mycompany.com
> From: knst.koli...@gmail.com
> To: users@tomcat.apache.org
> 
> 2013/12/16 James H. H. Lampert :
> > On 12/16/13 9:37 AM, pierre posset wrote:
> >>>>
> >>>> My problem is that when in a browser I am writing mycompany.com I am
> >>>> redirected with to www.mycompany.com.
> >
> >
> > I could be way off-base here (it wouldn't be the first time!), but:
> >
> > It could also be that your browser thinks it's smarter than you are. I've
> > seen browsers apparently redirect themselves (without any redirect having
> > been set up) to variations on a URL, and/or to whatever is set as their
> > default search engine, but so far as I know, that usually only happens if
> > the browser can't resolve the URL as entered, or if the user didn't
> > explicitly type the protocol prefix on the URL.
> 
> By the way, the setting name in Mozilla Firefox is
> "browser.fixup.alternate.enabled"
> I usually explicitly change this and "keyword.enabled" settings to the
> value of "false".
> 
> http://www.mozilla.org/docs/end-user/domain-guessing.html
> http://kb.mozillazine.org/Keyword.enabled
> 
> 
> > Does it happen with other browsers? Does it happen if you try it from
> > someplace with a completely different web connection? Have you tried
> > explicitly typing the http:// or the https:// at the beginning of the URL?
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread Konstantin Kolinko
2013/12/16 James H. H. Lampert :
> On 12/16/13 9:37 AM, pierre posset wrote:

 My problem is that when in a browser I am writing mycompany.com I am
 redirected with to www.mycompany.com.
>
>
> I could be way off-base here (it wouldn't be the first time!), but:
>
> It could also be that your browser thinks it's smarter than you are. I've
> seen browsers apparently redirect themselves (without any redirect having
> been set up) to variations on a URL, and/or to whatever is set as their
> default search engine, but so far as I know, that usually only happens if
> the browser can't resolve the URL as entered, or if the user didn't
> explicitly type the protocol prefix on the URL.

By the way, the setting name in Mozilla Firefox is
"browser.fixup.alternate.enabled"
I usually explicitly change this and "keyword.enabled" settings to the
value of "false".

http://www.mozilla.org/docs/end-user/domain-guessing.html
http://kb.mozillazine.org/Keyword.enabled


> Does it happen with other browsers? Does it happen if you try it from
> someplace with a completely different web connection? Have you tried
> explicitly typing the http:// or the https:// at the beginning of the URL?
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Pierre,

On 12/16/13, 12:23 PM, pierre posset wrote:
> I am using tomcat7 on a debian.
> 
> My problem is that when in a browser I am writing mycompany.com I
> am redirected with to www.mycompany.com.
> 
> I am using the node host with some nodes alias.
> 
> I have searched in many configuration file and also on google but
> I do not find any answer to my behavior, is there someone who can
> help me?

What is your setup and configuration?

Have you used an HTTP protocol analyzer to see if the server is in
fact redirecting the client?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSr1P0AAoJEBzwKT+lPKRY4KIP/1IlGMF3NCKIYqoHIchoeM+c
4gn4BSyaQj/hStYmf9T9l/ZIZMbjpcwZj79UHZry32IDO1E4VqiBRJ1MIB45SZg3
hYmzsXY7ULt3cRpCOu00uRArjT5LjTFkaLXTjzSBaCVODdElkFsJ4KS+B0S17ONq
yUTs0ONbqFgIeVSGAZcHDErM/7OCIRo4Gg6YlUnfKU6JU+TXREXLuyih4vQpgZ2f
GpDAw98h6C6Bzfs6NpE/5Zt6akRoNI5GhvwAw4/cCpfpTe6pijCeAkP3knt6M9yN
u+DlKoPKRpM6Ezxe83OeW2D9mqcOo21+xyv0k9Nu8eevKw7YSNqF7VqWC01hflvA
ERnTaQ+6NwIBcr2ZmfPtA37J1113YgF9IU5HIvlFyKF3x8MF/D80Pdhm9Ri4fZCq
tflITS9JlVUa1G7vgyj9+auLRiikqdwHF4fRNkc9cwr6ipucWEYa8Mw+OYcOGxlB
85KZChesp5sX5ggHWOV7jSSA4kiIj7Cp1QB0ypXTc2MlpVWqWiDjvNpkln6nCN8P
XL/Pasyi39auxRiZU1KwW5Db1SRgmNjY60bjoq5vpdxDpuIdhmkZp6USAEwg5P8Z
RZQpaYKDXNiywsWDX9FoyES11KJKHGX3v3XEfxX3p4RYg/xsVpFYKaNR4ZoOsaom
UbJutrtROwVEXNaODWl0
=jciL
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread James H. H. Lampert

On 12/16/13 9:37 AM, pierre posset wrote:

My problem is that when in a browser I am writing mycompany.com I am redirected 
with to www.mycompany.com.


I could be way off-base here (it wouldn't be the first time!), but:

It could also be that your browser thinks it's smarter than you are. 
I've seen browsers apparently redirect themselves (without any redirect 
having been set up) to variations on a URL, and/or to whatever is set as 
their default search engine, but so far as I know, that usually only 
happens if the browser can't resolve the URL as entered, or if the user 
didn't explicitly type the protocol prefix on the URL.


Does it happen with other browsers? Does it happen if you try it from 
someplace with a completely different web connection? Have you tried 
explicitly typing the http:// or the https:// at the beginning of the URL?


--
JHHL

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread pierre posset
Thank you for your answer I will try to see if it is something like that which 
is happening.

> Date: Mon, 16 Dec 2013 12:34:19 -0500
> From: rhi...@sympatico.ca
> To: users@tomcat.apache.org
> Subject: Re: Redirection of mycompany.com to www.mycompany.com
> 
> On 2013-12-16 12:23 PM, pierre posset wrote:
> > Hello,
> >
> > I have a strange behavior and I do not know where to watch.
> >
> > I am using tomcat7 on a debian.
> >
> > My problem is that when in a browser I am writing mycompany.com I am 
> > redirected with to www.mycompany.com.
> >
> > I am using the node host with some nodes alias.
> >
> > I have searched in many configuration file and also on google but I do not 
> > find any answer to my behavior, isthere someone who can help me?
> >
> > Thank you.
> >
> > Best Regards,
> >
> > Pierre Posset.
> > 
> >
> I use a service called ZoneEdit (zoneedit.com) which lets you create 
> records that cause similar redirections. For example, I can point a 
> domain name, like mydomain.com to xyz.techstuff.net with their records. 
> Perhaps something like that is causing the redirection, rather than any 
> entries on the server itself?
> 
> I expect other companies provide the same services as ZoneEdit
> 
> -- 
> Reinhardt
> 
> ---
> This email is free from viruses and malware because avast! Antivirus 
> protection is active.
> http://www.avast.com
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread Reinhardt Christiansen

On 2013-12-16 12:23 PM, pierre posset wrote:

Hello,

I have a strange behavior and I do not know where to watch.

I am using tomcat7 on a debian.

My problem is that when in a browser I am writing mycompany.com I am redirected 
with to www.mycompany.com.

I am using the node host with some nodes alias.

I have searched in many configuration file and also on google but I do not find 
any answer to my behavior, isthere someone who can help me?

Thank you.

Best Regards,

Pierre Posset.


I use a service called ZoneEdit (zoneedit.com) which lets you create 
records that cause similar redirections. For example, I can point a 
domain name, like mydomain.com to xyz.techstuff.net with their records. 
Perhaps something like that is causing the redirection, rather than any 
entries on the server itself?


I expect other companies provide the same services as ZoneEdit

--
Reinhardt

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Redirection of mycompany.com to www.mycompany.com

2013-12-16 Thread pierre posset
Hello,

I have a strange behavior and I do not know where to watch.

I am using tomcat7 on a debian.

My problem is that when in a browser I am writing mycompany.com I am redirected 
with to www.mycompany.com.

I am using the node host with some nodes alias.

I have searched in many configuration file and also on google but I do not find 
any answer to my behavior, isthere someone who can help me?

Thank you.

Best Regards,

Pierre Posset.
  

RE: redirection of www.xyz.com/xyz to https://xyz.com/xyz.html is not happening in httpd.conf

2012-12-27 Thread Caldarale, Charles R
> From: Dhaval Jaiswal [mailto:dhaval.jais...@via.com] 
> Subject: redirection of www.xyz.com/xyz to https://xyz.com/xyz.html is not 
> happening in httpd.conf

> i have tried through Redirect option to redirect specific page to one *.html

> it is not redirecting. Still it is redirecting to old values only.

> Even i have tried through Rewriterule.

This is the Tomcat mailing list; perhaps you want the one for httpd.  Before 
posting on that list, you might want to read this first:

http://www.catb.org/~esr/faqs/smart-questions.html

and then provide specifics rather than vague ramblings.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



redirection of www.xyz.com/xyz to https://xyz.com/xyz.html is not happening in httpd.conf

2012-12-27 Thread Dhaval Jaiswal
i have tried through Redirect option to redirect specific page to one *.html

it is not redirecting. Still it is redirecting to old values only.

Even i have tried through Rewriterule.

Any other efficient way will be helpful to me.


--


RE: tomcat redirection

2012-08-06 Thread Finkeldei, Brad
Thanks I am seeing that in a lot of threads I've been researching.

Have  a good one!!

Brad 

-Original Message-
From: Mark Eggers [mailto:its_toas...@yahoo.com] 
Sent: Monday, August 06, 2012 11:06 AM
To: users@tomcat.apache.org
Subject: Re: tomcat redirection

On 8/6/2012 9:02 AM, Finkeldei, Brad wrote:
> We want to do a redirect based on context of the URL. We don't use 
> apache and
>
> For example say https://anydomain.com/orders/* To 
> https://anydomain/mtcepage
>
> I know how to do in apache but not tomcat...
>
> Thanks,
>
> Brad
>
>

This comes up quite a bit in the mailing list. Archives are searchable and 
online.

http://tuckey.org/urlrewrite/

. . . . just my two cents
/mde/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: tomcat redirection

2012-08-06 Thread Mark Eggers

On 8/6/2012 9:02 AM, Finkeldei, Brad wrote:

We want to do a redirect based on context of the URL. We don't use apache and

For example say https://anydomain.com/orders/*
To
https://anydomain/mtcepage

I know how to do in apache but not tomcat...

Thanks,

Brad




This comes up quite a bit in the mailing list. Archives are searchable 
and online.


http://tuckey.org/urlrewrite/

. . . . just my two cents
/mde/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



tomcat redirection

2012-08-06 Thread Finkeldei, Brad
We want to do a redirect based on context of the URL. We don't use apache and

For example say https://anydomain.com/orders/*
To
https://anydomain/mtcepage

I know how to do in apache but not tomcat...

Thanks,

Brad



Re: xinetd port redirection for Tomcat

2011-11-26 Thread Pierre Goupil
Chuck,

I managed to give it a try and it works perfectly. Thanks!

Pierre



On Sat, Nov 26, 2011 at 9:55 PM, Pierre Goupil wrote:

> Thanks Chuck! I'll try it tomorrow.
>
>
>
>
> On Sat, Nov 26, 2011 at 9:40 PM, Caldarale, Charles R <
> chuck.caldar...@unisys.com> wrote:
>
>> > From: Pierre Goupil [mailto:goupilpie...@gmail.com]
>> > Subject: xinetd port redirection for Tomcat
>>
>> > Shall I use another way of binding Tomcat to port 80?
>>
>> Try iptables - it's even simpler.  Something like the following should
>> work:
>>
>> /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT
>> --to-port 8080
>>
>> Set your Tomcat  port to 8080; external requests coming into
>> port 80 will be automatically redirected to 8080.  Make sure your Linux
>> firewall has 8080 open.
>>
>>  - Chuck
>>
>>
>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>> MATERIAL and is thus for use only by the intended recipient. If you
>> received this in error, please contact the sender and delete the e-mail and
>> its attachments from all computers.
>>
>>
>
>
> --
> Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
> assez fort.
>
>


-- 
Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
assez fort.


Re: xinetd port redirection for Tomcat

2011-11-26 Thread Pierre Goupil
Thanks Chuck! I'll try it tomorrow.



On Sat, Nov 26, 2011 at 9:40 PM, Caldarale, Charles R <
chuck.caldar...@unisys.com> wrote:

> > From: Pierre Goupil [mailto:goupilpie...@gmail.com]
> > Subject: xinetd port redirection for Tomcat
>
> > Shall I use another way of binding Tomcat to port 80?
>
> Try iptables - it's even simpler.  Something like the following should
> work:
>
> /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT
> --to-port 8080
>
> Set your Tomcat  port to 8080; external requests coming into
> port 80 will be automatically redirected to 8080.  Make sure your Linux
> firewall has 8080 open.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail and
> its attachments from all computers.
>
>


-- 
Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
assez fort.


RE: xinetd port redirection for Tomcat

2011-11-26 Thread Caldarale, Charles R
> From: Pierre Goupil [mailto:goupilpie...@gmail.com] 
> Subject: xinetd port redirection for Tomcat

> Shall I use another way of binding Tomcat to port 80?

Try iptables - it's even simpler.  Something like the following should work:

/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Set your Tomcat  port to 8080; external requests coming into port 80 
will be automatically redirected to 8080.  Make sure your Linux firewall has 
8080 open.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



xinetd port redirection for Tomcat

2011-11-26 Thread Pierre Goupil
Good evening,

I use xinetd in order to bind my Tomcat 7.0.22 instance to port 80 without
any Unix privileges, on a Debian 6.0 box. Here's the (slightly obfuscated)
configuration file:

service www
{
socket_type = stream
protocol= tcp
user= root
wait= no
bind= my IP
port= 80
redirect= localhost 8080
disable = no
flags   = REUSE
log_type= FILEmy.log
log_on_success  -= PID HOST DURATION EXIT

per_source  = UNLIMITED
instances   = UNLIMITED
}

It works generally great but there's one problem: in my logs, only the
localhost IP appears! I mean, in PsiProbe for instance, when I try and see
the IPs of my visitors, I can only find localhost. Which is bad, regarding
traffic statistics...

Does any one have a clue? Shall I use another way of binding Tomcat to port
80? Which one? This way looked good as it's really simple to set up, but if
I must use something else, I don't care. Please note, I'd prefer stick to
xinetd, though.

Regards,

Pierre


Re: redirection error due to context path after JAAS authentication with mod_proxy

2011-10-14 Thread Woonsan Ko





>
>From: André Warnier 
>To: Tomcat Users List 
>Sent: Wednesday, October 12, 2011 11:52 AM
>Subject: Re: redirection error due to context path after JAAS authentication 
>with mod_proxy
>
>Woonsan Ko wrote:
>> Hi,
>> 
>> I have a reverse proxy configuration like this:
>> 
>>    ServerName localhost   ProxyPreserveHost On   ProxyPass 
>> / http://localhost:8080/app1/   ProxyPassReverse / 
>> http://localhost:8080/app1/   ProxyPassReverseCookiePath /app1 / 
>> 
>
>If it is really like above, then why are you using an Apache httpd front-end 
>at all?
>Would it not be easier (+ simpler, + more efficient) to just get Tomcat to 
>listen on port 80 and whatever IP address Apache httpd is listening to right 
>now ?
>
>(To get exactly the same behaviour as above, you would also have to make 
>"app1" be the Tomcat ROOT application.)
>
>Note: I also use a lot of setups with Apache httpd as front-end, and Tomcat as 
>a back-end, and sometimes this is very practical.  At least, when the Apache 
>httpd front-end is actually "doing something" other than forwarding the 
>requests to Tomcat.
>But here, it does not seem to be doing anything at all.

Yeah, actually I gave a simplified example configuration in order to show proxy 
mappings.
We have many other reasons to keep apache httpd as front-end here.
I've suggested a system administrator about deploying app to ROOT as a 
workaround, but they are not willing to do that for some reasons.

Anyway, if there's no way to customize redirection behavior after JAAS login, 
then I probably need to find a more controllable solution instead of using 
Tomcat's JAAS login feature. (Spring Security seems a good alternative which is 
filter based.)

Thanks anyway,

Woonsan

>
>
>
>
>
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
>


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: redirection error due to context path after JAAS authentication with mod_proxy

2011-10-12 Thread Brian Burch

On 12/10/11 17:51, Woonsan Ko wrote:

One simple strong reason is that I don't want to run tomcat by root.


The debian/ubuntu deb package installs tomcat6 so that it uses authbind 
to listen on ports < 1024, and it runs under its own non-root uid/gid. I 
was very impressed when I converted from tomcat5 as a vanilla install to 
tomcat6 as a deb.


Even if you are not on debian, perhaps looking at the installation 
script and file structure will help you set up something similar.


Regards,

Brian

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: redirection error due to context path after JAAS authentication with mod_proxy

2011-10-12 Thread Pid
On 12/10/2011 17:51, Woonsan Ko wrote:
> 
> - Original Message -
>> From: André Warnier 
>> To: Tomcat Users List 
>> Cc: 
>> Sent: Wednesday, October 12, 2011 11:52 AM
>> Subject: Re: redirection error due to context path after JAAS authentication 
>> with mod_proxy
>>
>> Woonsan Ko wrote:
>>>  Hi,
>>>
>>>  I have a reverse proxy configuration like this:
>>>
>>> ServerName localhost   ProxyPreserveHost On  
>> ProxyPass / http://localhost:8080/app1/   ProxyPassReverse / 
>> http://localhost:8080/app1/   ProxyPassReverseCookiePath /app1 / 
>> 
>>
>> If it is really like above, then why are you using an Apache httpd front-end 
>> at 
>> all?
>> Would it not be easier (+ simpler, + more efficient) to just get Tomcat to 
>> listen on port 80 and whatever IP address Apache httpd is listening to right 
>> now 
>> ?
> 
> One simple strong reason is that I don't want to run tomcat by root.

JSVC, iptables, Tanuki - bunch of different way to handle that.


p


>> (To get exactly the same behaviour as above, you would also have to make 
>> "app1" be the Tomcat ROOT application.)
>>
>> Note: I also use a lot of setups with Apache httpd as front-end, and Tomcat 
>> as a 
>> back-end, and sometimes this is very practical.  At least, when the Apache 
>> httpd 
>> front-end is actually "doing something" other than forwarding the 
>> requests to Tomcat.
>> But here, it does not seem to be doing anything at all.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 




signature.asc
Description: OpenPGP digital signature


Re: redirection error due to context path after JAAS authentication with mod_proxy

2011-10-12 Thread Woonsan Ko




- Original Message -
> From: André Warnier 
> To: Tomcat Users List 
> Cc: 
> Sent: Wednesday, October 12, 2011 11:52 AM
> Subject: Re: redirection error due to context path after JAAS authentication 
> with mod_proxy
> 
> Woonsan Ko wrote:
>>  Hi,
>> 
>>  I have a reverse proxy configuration like this:
>> 
>>     ServerName localhost   ProxyPreserveHost On  
> ProxyPass / http://localhost:8080/app1/   ProxyPassReverse / 
> http://localhost:8080/app1/   ProxyPassReverseCookiePath /app1 / 
> 
> 
> If it is really like above, then why are you using an Apache httpd front-end 
> at 
> all?
> Would it not be easier (+ simpler, + more efficient) to just get Tomcat to 
> listen on port 80 and whatever IP address Apache httpd is listening to right 
> now 
> ?

One simple strong reason is that I don't want to run tomcat by root.

Thanks,

Woonsan

> 
> (To get exactly the same behaviour as above, you would also have to make 
> "app1" be the Tomcat ROOT application.)
> 
> Note: I also use a lot of setups with Apache httpd as front-end, and Tomcat 
> as a 
> back-end, and sometimes this is very practical.  At least, when the Apache 
> httpd 
> front-end is actually "doing something" other than forwarding the 
> requests to Tomcat.
> But here, it does not seem to be doing anything at all.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: redirection error due to context path after JAAS authentication with mod_proxy

2011-10-12 Thread André Warnier

Woonsan Ko wrote:

Hi,

I have a reverse proxy configuration like this:

 
  ServerName localhost 
  ProxyPreserveHost On 
  ProxyPass / http://localhost:8080/app1/ 
  ProxyPassReverse / http://localhost:8080/app1/ 
  ProxyPassReverseCookiePath /app1 / 



If it is really like above, then why are you using an Apache httpd front-end at 
all?
Would it not be easier (+ simpler, + more efficient) to just get Tomcat to listen on port 
80 and whatever IP address Apache httpd is listening to right now ?


(To get exactly the same behaviour as above, you would also have to make "app1" be the 
Tomcat ROOT application.)


Note: I also use a lot of setups with Apache httpd as front-end, and Tomcat as a back-end, 
and sometimes this is very practical.  At least, when the Apache httpd front-end is 
actually "doing something" other than forwarding the requests to Tomcat.

But here, it does not seem to be doing anything at all.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



redirection error due to context path after JAAS authentication with mod_proxy

2011-10-12 Thread Woonsan Ko
Hi,

I have a reverse proxy configuration like this:

 
  ServerName localhost 
  ProxyPreserveHost On 
  ProxyPass / http://localhost:8080/app1/ 
  ProxyPassReverse / http://localhost:8080/app1/ 
  ProxyPassReverseCookiePath /app1 / 


And, I have a form-based login configuration for JAAS authentication.
When I try log on, the redirect location (the secured resource path) after 
/j_security_check seems to be prepended by the context path, '/app1'. (e.g. 
Location: http://localhost/app1/login/resource, instead of 
http://localhost/login/resource)
I guess there will be other solutions with more sophisticated configuration for 
mod_proxy by adding more external server addresses. 
However, I'd like to avoid that if possible because the external addresses can 
be changed/added at any time.

Is there any way to customize the redirection after authentication (e.g. by 
using absolute url generation with a custom component) ?

Regards,

Woonsan

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how to set auto redirection in tomcat

2011-02-23 Thread James Godrej



On Thu, Feb 24, 2011 at 4:41 AM, Christopher Schultz 
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> James,
>
> On 2/23/2011 5:16 PM, James Godrej wrote:
>> - Original Message 
>> From: "Caldarale, Charles R" 
>> To: Tomcat Users List 
>> Sent: Thu, 24 February, 2011 3:01:01 AM
>> Subject: RE: how to set auto redirection in tomcat
>>
>>> From: James Godrej [mailto:jamesgod...@yahoo.in]
>>> Subject: how to set auto redirection in tomcat
>>
>>> I am using mod_ajp as a front end
>>
>>> Why?  What purpose is it serving?
>>> If it's not doing anything useful (e.g., handling PHP), you should simplify 
>>>your
>>> life and remove it.
>>
>> I am running at least 20 other websites and 2 of them use mod_proxy_ajp
>> each of these is hosted on some machine internally on lan.
>>
>>> How ever I have an application running on it
>>> http://social.openitup.in/olat
>>> what I want to do is when some one opens
>>> http://social.openitup.in
>>
>>> Remove the existing ROOT application, and rename yours to ROOT.
>>
>> No this did not worked I tried.
>
> Did you name it "ROOT", or did you name it "root" (or "Root" or "rOOt"
> or "rooT")? Case matters, even on win32.
>
> You might have to restart Tomcat after doing that.
>
> Using "ROOT" as the webapp name definitely works. People do it all the
> time...
>
Yes renaming to ROOT worked.Thanks 
Christopher.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how to set auto redirection in tomcat

2011-02-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

James,

On 2/23/2011 5:16 PM, James Godrej wrote:
> - Original Message 
> From: "Caldarale, Charles R" 
> To: Tomcat Users List 
> Sent: Thu, 24 February, 2011 3:01:01 AM
> Subject: RE: how to set auto redirection in tomcat
> 
>> From: James Godrej [mailto:jamesgod...@yahoo.in] 
>> Subject: how to set auto redirection in tomcat
> 
>> I am using mod_ajp as a front end 
> 
>> Why?  What purpose is it serving?  
>> If it's not doing anything useful (e.g., handling PHP), you should simplify 
>> your 
>> life and remove it.
> 
> I am running at least 20 other websites and 2 of them use mod_proxy_ajp
> each of these is hosted on some machine internally on lan.
> 
>> How ever I have an application running on it 
>> http://social.openitup.in/olat 
>> what I want to do is when some one opens 
>> http://social.openitup.in 
> 
>> Remove the existing ROOT application, and rename yours to ROOT.
> 
> No this did not worked I tried.

Did you name it "ROOT", or did you name it "root" (or "Root" or "rOOt"
or "rooT")? Case matters, even on win32.

You might have to restart Tomcat after doing that.

Using "ROOT" as the webapp name definitely works. People do it all the
time...

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

iEYEARECAAYFAk1llD8ACgkQ9CaO5/Lv0PD0twCeK84xRWWUFC92plxV18I45ICe
e7AAoI7AezKBuR47d2J3TuhLL0u/JgZ5
=CM7H
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how to set auto redirection in tomcat

2011-02-23 Thread James Godrej




- Original Message 
From: "Caldarale, Charles R" 
To: Tomcat Users List 
Sent: Thu, 24 February, 2011 3:01:01 AM
Subject: RE: how to set auto redirection in tomcat

> From: James Godrej [mailto:jamesgod...@yahoo.in] 
> Subject: how to set auto redirection in tomcat

> I am using mod_ajp as a front end 

>Why?  What purpose is it serving?  
>If it's not doing anything useful (e.g., handling PHP), you should simplify 
>your 
>life and remove it.

I am running at least 20 other websites and 2 of them use mod_proxy_ajp
each of these is hosted on some machine internally on lan.

> How ever I have an application running on it 
> http://social.openitup.in/olat 
> what I want to do is when some one opens 
> http://social.openitup.in 

>Remove the existing ROOT application, and rename yours to ROOT.


No this did not worked I tried.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: how to set auto redirection in tomcat

2011-02-23 Thread Caldarale, Charles R
> From: James Godrej [mailto:jamesgod...@yahoo.in] 
> Subject: how to set auto redirection in tomcat

> I am using mod_ajp as a front end 

Why?  What purpose is it serving?  If it's not doing anything useful (e.g., 
handling PHP), you should simplify your life and remove it.

> How ever I have an application running on it 
> http://social.openitup.in/olat
> what I want to do is when some one opens 
> http://social.openitup.in

Remove the existing ROOT application, and rename yours to ROOT.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



how to set auto redirection in tomcat

2011-02-23 Thread James Godrej
I have a site http://social.openitup.in
right now what you are seeing is a default Tomcat6 page.
I am using mod_ajp as a front end and Apache vhost configuration for same is 



ServerName social.openitup.in
ServerAdmin webmaster@localhost

ProxyRequests off

Order deny,allow
Allow from all

ProxyPreserveHost On

ProxyPass / ajp://192.168.1.19:8009/
ProxyPassReverse / ajp://192.168.1.19:8009/







How ever I have an application running on it 
http://social.openitup.in/olat
what I want to do is when some one opens 
http://social.openitup.in
then rather than seeing Tomcat6 home page from
/var/lib/tomcat6/webapps/ROOT/index.html
the person is  redirected to olat application which is in 
/var/lib/tomcat6/webapps/olat
how can this be achived?



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Tomcat url redirection

2010-09-21 Thread Caldarale, Charles R
> From: rujin raj [mailto:rujin...@gmail.com] 
> Subject: Tomcat url redirection

> I want http://events.mydomain.xxx/ to
> go to http://events.mydomain.xxx/myapp.

Then name your webapp ROOT (case sensitive, even on Windows), not myapp, just 
as the Tomcat doc says to do.

> Moreover whenever i type the Public
> IP address (http://xxx.yyy.zzz.aaa) instead of
> events.mydomain.xxx should also redirect to
> http://events.mydomain.xxx/myapp.

That will happen automatically if events.mydomain.xxx and xxx.yyy.zzz.aaa both 
map to an IP address on the server on which Tomcat runs, *and* you have Tomcat 
listening on address 0.0.0.0 (the default), *and* you rename your app to ROOT, 
as noted above.

No rewrite filters are required if you set things up properly.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat url redirection

2010-09-21 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rujin,

On 9/21/2010 2:22 PM, rujin raj wrote:
> Moreover whenever i type the Public
> IP address (http://xxx.yyy.zzz.aaa) instead of
> events.mydomain.xxx should also redirect to
>   http://events.mydomain.xxx/myapp.

See Michel's response for redirection. If you want IP -> hostname
switching, set up a rule that looks for a non-preferred "Host" header
and issues a redirect.

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

iEYEARECAAYFAkyZBE4ACgkQ9CaO5/Lv0PBNsQCeLQH8l961InR8mM0Z7vzp/LtV
GJEAoIrYnOoVKegQqMgOYEvHoIQa4oal
=52TO
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat url redirection

2010-09-21 Thread michel

http://tuckey.org



- Original Message - 
From: "rujin raj" 

To: 
Sent: Tuesday, September 21, 2010 2:22 PM
Subject: Tomcat url redirection



*Support team,
*
*
*
*
I'm working with an application that uses apache tomcat 6 to serve the
website. I've installed the application and tomcat on a Windows 2003
server and everything is working fine.For instance I want
http://events.mydomain.xxx/ to
go to http://events.mydomain.xxx/myapp.Moreover whenever i type the Public
IP address (http://xxx.yyy.zzz.aaa) instead of
events.mydomain.xxx should also redirect to
 http://events.mydomain.xxx/myapp.

Any ideas how I might do this with apache tomcat would be very helpful
and appreciated.

Thank you in advance.

Regards
rujinraj
*




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Tomcat url redirection

2010-09-21 Thread rujin raj
*Support team,
*
*
*
*
I'm working with an application that uses apache tomcat 6 to serve the
website. I've installed the application and tomcat on a Windows 2003
server and everything is working fine.For instance I want
http://events.mydomain.xxx/ to
go to http://events.mydomain.xxx/myapp.Moreover whenever i type the Public
IP address (http://xxx.yyy.zzz.aaa) instead of
events.mydomain.xxx should also redirect to
  http://events.mydomain.xxx/myapp.

Any ideas how I might do this with apache tomcat would be very helpful
and appreciated.

Thank you in advance.

Regards
rujinraj
*


Re: the welcome file "index.jsp" returns an 302 redirection

2010-07-08 Thread Bill Barker



"lei jiang"  wrote in message 
news:aanlktin0dhodp9brzlx589xkvuz4dar0dnklry637...@mail.gmail.com...

Hi, guys:

I am using the Tomcat 5.0.28.0, and I put the my website into webapps 
directory.


The welcome-file-list section likes this:


   index.jsp


In the index.jsp, I use the jsp:forward tag to forward the request to
a struts action:


When I input "http://localhost:8080/mysite"; into the address bar of
firefox and hit go button, the browser shows the correct page but the
url in address bar changed to
"http://localhost:8080/mysite/welcome.do";

I find that the tomcat returns a 302 redirection and then the tomcat
returns the page generated by "welcome.do" action

So what can we do to aviod the 302 redirection and let the address bar
just show "http://localhost:8080/mysite";.



What Pid said:  Later versions than 5.0.x do an internal forward to the 
welcome-file, so the browser doesn't get to see the actual path to the 
welcome-file.  There are a couple of other sordid hacks using 
servlet-mapping that I'll admit to using on currently unsupported versions 
of Tomcat.



Thanks
Regards
--
Lei Jiang
Member of SeedClass in the Department of Electronics and Information 
Engineering

Member of Overseas group in Dian team
Room 507, Building D7,1037 Luoyu Road, Wuhan 430074,P.R.China
Mobile:+86-15926351274
Email:  




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: the welcome file "index.jsp" returns an 302 redirection

2010-07-07 Thread Pid
On 07/07/2010 11:25, André Warnier wrote:
> lei jiang wrote:
>> Hi, guys:
>>
>> I am using the Tomcat 5.0.28.0, and I put the my website into webapps
>> directory.
>>
>> The welcome-file-list section likes this:
>>
>> 
>> index.jsp
>> 
>>
>> In the index.jsp, I use the jsp:forward tag to forward the request to
>> a struts action:
>> 
>>
>> When I input "http://localhost:8080/mysite"; into the address bar of
>> firefox and hit go button, the browser shows the correct page but the
>> url in address bar changed to
>> "http://localhost:8080/mysite/welcome.do";
>>
>> I find that the tomcat returns a 302 redirection and then the tomcat
>> returns the page generated by "welcome.do" action
>>
>> So what can we do to aviod the 302 redirection and let the address bar
>> just show "http://localhost:8080/mysite";.
>>
> Naive suggestions :
> 
> 1)
>  
>  welcome.do
>  
> 
> 2) delete index.jsp and rename welcome.do to index.jsp

3) Upgrade your Tomcat, 5.0.x isn't supported anymore and it's REALLY OLD.


p


> ?
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 




signature.asc
Description: OpenPGP digital signature


  1   2   3   >