Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

HELP: apache rewrite rule destroys sessionid for tomcat?

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Does Tomcat have httpd.conf?  
Author Message
user2819

External


Since: Jun 11, 2004
Posts: 4



(Msg. 1) Posted: Fri Jun 11, 2004 3:58 pm
Post subject: HELP: apache rewrite rule destroys sessionid for tomcat?
Archived from groups: alt>apache>configuration (more info?)

hi ng,

the problem:
our tomcat does not get any information about the used session (sessionid
lost, causes by rewriterule?), when using the apache1 (with a rewriterule to
the apache2). It seems, that the tomcat creates a new session each time,
when a jsp is requested.

It works, when we are directly using the apache2.

Request --> apache1(rewriterule) --> apache2(Bridge) --> tomcat

we are using an apache 1.3.27 and a tomcat 4.1. The tomcat is included into
the apache with mod_jk2, using the following params in workers2 (Apache2):
[logger]
level=DEBUG
[config:]
file=/etc/httpd/conf/workers2.properties
debug=1
debugEnv=0
[uriMap:]
info=Maps the requests
debug=1
[channel.socket:xxx.xxx.xxx.xxx:8009]
info=Ajp13 forwarding over socket
tomcatId=xxx.xxx.xxx.xxx:8009
[uri:/etz/*]
#worker=ajp13:xxx.xxx.xxx.xxx:8009
info=Application
[shm:]
info=Scoreboard
file=/etc/httpd/logs/jk2.shm
size=100000
debug=0
disabled=0


Our rewrite rule in httpd.conf (Apache1):
<IfModule mod_proxy.c>
NoCache *
ProxyRequests On
RewriteEngine On
RewriteLog /var/log/httpd/rewrite_log
RewriteLogLevel 3
RewriteRule ^/pms/(.*)$ http://ourserver/$1 [P,L]
</IfModule>


thanks for answers
Frank

 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 2) Posted: Fri Jun 11, 2004 3:58 pm
Post subject: Re: HELP: apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Frank <Frank.Martens_no!spamx!xmm@bertelsmann.de> wrote:
 > our tomcat does not get any information about the used session (sessionid
 > lost, causes by rewriterule?

Usually sessions are kept using cookies or (less common) sessionid on the
URL. If you are using the latter, be sure to preserve the session id.
It's time for you to do some debugging about what kind of sessionid
is used by your application and if there are problems in preserving
those info.

Davide

--
| But officer, I was only trying to gain enough speed so I could coast
| to the nearest gas station.
|
|<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
user2819

External


Since: Jun 11, 2004
Posts: 4



(Msg. 3) Posted: Fri Jun 11, 2004 5:00 pm
Post subject: Re: HELP: apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Davide,

"Davide Bianchi" <davideyeahsure.DeleteThis@onlyforfun.net> schrieb im Newsbeitrag
news:2itihrFradc6U3@uni-berlin.de...
 > Frank <Frank.Martens_no!spamx!xmm@bertelsmann.de> wrote:
  > > our tomcat does not get any information about the used session
(sessionid
  > > lost, causes by rewriterule?
 >
 > Usually sessions are kept using cookies or (less common) sessionid on the
 > URL. If you are using the latter, be sure to preserve the session id.
 > It's time for you to do some debugging about what kind of sessionid
we are using cookie-sessionids like
Cookie - JSESSIONID=AJOn1QgJue0NSRJEth4ETlAj2Jl71l11ICW.........
and i think that this id is lost, when rewriting to the second apache.

 > is used by your application and if there are problems in preserving
 > those info.
 >
 > Davide
 >
 > --
 > | But officer, I was only trying to gain enough speed so I could coast
 > | to the nearest gas station.
 > |
 > |

Frank<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 4) Posted: Fri Jun 11, 2004 5:00 pm
Post subject: Re: HELP: apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Frank <Frank.Martens_no!spamx!xmm@bertelsmann.de> wrote:
 > Cookie - JSESSIONID=AJOn1QgJue0NSRJEth4ETlAj2Jl71l11ICW.........
 > and i think that this id is lost, when rewriting to the second apache.

That info should be part of the http request, so not tampered by the
rewrite rule. But the only way to be sure is to check what kind of
request is received by the second apache _after_ the first one applied
his rewrite rule.

A quick check is: disable the rewrite rule and just pass everything to the
first one as-it-is.

Davide

--
| If you keep anything long enough, you can throw it away.
|
|
|<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 5) Posted: Sat Jun 12, 2004 2:24 am
Post subject: Re: HELP: apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Frank" <Frank.Martens_no!spamx!xmm@Bertelsmann.de> schreef in bericht
news:2itl6tFqjtn8U1@uni-berlin.de...
 > "Davide Bianchi" <davideyeahsure.TakeThisOut@onlyforfun.net> schrieb im Newsbeitrag
 > news:2itihrFradc6U3@uni-berlin.de...
  > > Usually sessions are kept using cookies or (less common) sessionid on
the
  > > URL. If you are using the latter, be sure to preserve the session id.
.... by just adding QSA to your rule:
RewriteRule ^/pms/(.*)$ <a style='text-decoration: underline;' href="http://ourserver/$1" target="_blank">http://ourserver/$1</a> [QSA,P,L]

  > > It's time for you to do some debugging about what kind of sessionid
 > we are using cookie-sessionids like
 > Cookie - JSESSIONID=AJOn1QgJue0NSRJEth4ETlAj2Jl71l11ICW.........
 > and i think that this id is lost, when rewriting to the second apache.
The upstream server is adding a 'Set-Cookie: ...' header to its response.
This header is likely refering to another server or domain than the proxy
the browser _thinks_ it is addressing, resulting in a deniable cross-domain
cookie... If all servers are within the same domain, try to change from
server-cookies to domain-cookies.

IMHO a proxy setup should use a 'proxypass' directive instead of a
rewriterule _and_ a 'proxypassreverse' directive to change the http response
headers accordingly.
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypass" target="_blank">http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypass</a>
BTW if your application -at ourserver- uses absolute URLs or URIs in its
link you have quite a problem Sad


HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
user2819

External


Since: Jun 11, 2004
Posts: 4



(Msg. 6) Posted: Wed Jun 16, 2004 2:22 pm
Post subject: Re: THE SOLUTION - apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

We made it!

we have to use the same web-applicationnames in the rewriterule, because
tomcat uses different cookies für each web-application and can't find
the right one, if you are not using the same url (pms).

wrong: RewriteRule ^/pms/(.*)$ <a style='text-decoration: underline;' href="http://ourserver/$1" target="_blank">http://ourserver/$1</a> [P,L]

right: RewriteRule ^/pms/(.*)$ <a style='text-decoration: underline;' href="http://ourserver/pms/$1" target="_blank">http://ourserver/pms/$1</a> [P,L]

Thanks, Frank


"Frank" <Frank.Martens_no!spamx!xmm@Bertelsmann.de> schrieb im Newsbeitrag
news:2ithjlFrdpjaU1@uni-berlin.de...
 > hi ng,
 >
 > the problem:
 > our tomcat does not get any information about the used session (sessionid
 > lost, causes by rewriterule?), when using the apache1 (with a rewriterule
to
 > the apache2). It seems, that the tomcat creates a new session each time,
 > when a jsp is requested.
 >
 > It works, when we are directly using the apache2.
 >
 > Request --> apache1(rewriterule) --> apache2(Bridge) --> tomcat
 >
 > we are using an apache 1.3.27 and a tomcat 4.1. The tomcat is included
into
 > the apache with mod_jk2, using the following params in workers2 (Apache2):
 > [logger]
 > level=DEBUG
 > [config:]
 > file=/etc/httpd/conf/workers2.properties
 > debug=1
 > debugEnv=0
 > [uriMap:]
 > info=Maps the requests
 > debug=1
 > [channel.socket:xxx.xxx.xxx.xxx:8009]
 > info=Ajp13 forwarding over socket
 > tomcatId=xxx.xxx.xxx.xxx:8009
 > [uri:/etz/*]
 > #worker=ajp13:xxx.xxx.xxx.xxx:8009
 > info=Application
 > [shm:]
 > info=Scoreboard
 > file=/etc/httpd/logs/jk2.shm
 > size=100000
 > debug=0
 > disabled=0
 >
 >
 > Our rewrite rule in httpd.conf (Apache1):
 > <IfModule mod_proxy.c>
 > NoCache *
 > ProxyRequests On
 > RewriteEngine On
 > RewriteLog /var/log/httpd/rewrite_log
 > RewriteLogLevel 3
 > RewriteRule ^/pms/(.*)$ <a style='text-decoration: underline;' href="http://ourserver/$1" target="_blank">http://ourserver/$1</a> [P,L]
 > </IfModule>
 >
 >
 > thanks for answers
 > Frank
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 7) Posted: Thu Jun 17, 2004 2:40 am
Post subject: Re: THE SOLUTION - apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Frank" <Frank.Martens_no!spamx!xmm@Bertelsmann.de> schreef in bericht
news:2jahqbFvfktmU1@uni-berlin.de...
 > we have to use the same web-applicationnames in the rewriterule, because
 > tomcat uses different cookies für each web-application and can't find
 > the right one, if you are not using the same url (pms).
A bit of a late respone, had to wait for Tomcat leaving Wink

ProxyPassReverse could have solved that problem, while the rewrite could
have been replaced by ProxyPass
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypassreverse" target="_blank">http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypassreverse</a>

HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
user2819

External


Since: Jun 11, 2004
Posts: 4



(Msg. 8) Posted: Fri Jun 18, 2004 12:15 pm
Post subject: Re: THE SOLUTION - apache rewrite rule destroys sessionid for tomcat? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"HansH" <hans DeleteThis @niet.op.het.net> schrieb im Newsbeitrag
news:caqenm$tsq$1@news.cistron.nl...
 > "Frank" <Frank.Martens_no!spamx!xmm@Bertelsmann.de> schreef in bericht
 > news:2jahqbFvfktmU1@uni-berlin.de...
  > > we have to use the same web-applicationnames in the rewriterule, because
  > > tomcat uses different cookies für each web-application and can't find
  > > the right one, if you are not using the same url (pms).
 > A bit of a late respone, had to wait for Tomcat leaving Wink
 >
 > ProxyPassReverse could have solved that problem, while the rewrite could
 > have been replaced by ProxyPass
<font color=purple> > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypassreverse</font" target="_blank">http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypassreverse</font</a>>
Our administrator tried this, but it didn't work. He'll try it again later.
Thanks for (late) response. And where is Tomcat now? Wink

 >
 > HansH
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: HELP: apache rewrite rule destroys sessionid for tomcat? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
rewrite rule - hi all can someone tell how i can traslate www.somesite.com/home/someuser to www.somesite.com/index.php?id=someuser it's possible with apache?i have to use a rewrite rule? help me please...

rewrite rule - Hi I want users of my site to be able to download video files, but only on specific conditions. To check these condition (to avoid hotlinking for example), I made a rewriterule: RewriteRule ([^.]*\.mpg) http://www2.tvreclames.nl/download.pl?file=$1 Fo...

Rewrite rule - I have a single Apache 1.3.6 server on my MacX Server (10.2.6) I have 15 Alexandria Library Servers at my schools. Our internal network is 10.0.0.0/8 with NAT to the outside. What I would like to do is add alink on each of the 15 locations web pages..

Rewrite Condition / Rewrite Rule - I've go this in my .htaccess file: RewriteEngine On RewriteCond %{REMOTE_ADDR} "^123\.123\.123\.123" RewriteRule ^/$ /why_am_i_here.html [L] Redirect permanent /robots.txt http://www.mysite.us/robots.php The permanent red...

Rewrite Rule Problem with Zope - I am setting up a Zope Site (zope) behind an Apache Server. I have the ReWrite rule working correctly: <VirtualHost 10.0.0.12:80> ServerName www.example.com ServerAlias example.com RewriteEngine on RewriteRule ^/(.*)..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]