Re: RewriteRule inside JkMount location
> RewriteRule ^myapp/some(.*) script.shtml%{QUERY_STRING} [L] > # Line above will be ignored > JkMount /myapp/* balancer > > May be this is just a bug? > So, i found that its work only if condition begins with / RewriteRule ^/myapp/some?(.*) /script.shtml?%{QUERY_STRING} [L,PT] Other conditions, not under /myapp/ works without first / ok. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
Hi, Rainer! Thx for you answer, its look like good solution, but anyway ignoring line BEFORE JkMount - a bit stupid behavior. RewriteRule ^myapp/some(.*) script.shtml%{QUERY_STRING} [L] # Line above will be ignored JkMount /myapp/* balancer May be this is just a bug? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
Only one little addition below: On 11.04.2009 14:19, André Warnier wrote: > J Channel wrote: > [...] > > Hi. > Let me jump in here for a while. > > First, I think it would be clearer (and certainly more efficient), to > move your Rewrite rules away from a .htaccess file in docroot, and just > put them in your main Apache configuration files. > (I suppose that if you have access to the DocumentRoot, you have access > to the server (or virtual server) *.conf, yes ?) > > Second, I personally find another syntax clearer than JkMount, specially > when you need to combine it with other rules in Apache. > The main reason is that indeed, it is not always very clear which kind > of "priority" JkMount/JkUnMount directives have, vis-a-vis Apache > Rewrite, etc.. > > So, for example, instead of writing > JkMount /myapp workername > JkMount /myapp/* workername > > you can also do it as follows : > > > SetHandler jakarta-servlet > > > > This is explained here: > http://tomcat.apache.org/connectors-doc/reference/apache.html > > in the section entitled : > Using SetHandler and Environment Variables > > Basically, the section above means that anything > corresponding to a URI starting with "/myapp" will be passed on to > Tomcat. It is thus equivalent to the duo > JkMount /myapp workername > JkMount /myapp/* workername > > but, in my view, it gives you more flexibility at the Apache level, and > also fits better with the Apache "way of things". > I think it makes the respective priorities of mod_jk and RewriteRules > clearer, because they are the same as what they are in Apache between > Rewrite and blocks. > For example, if you load the mod_setenvif module in Apache, you can > exclude some URI's inside of that location using this kind of thing : > > > SetHandler jakarta-servlet > SetEnvIf REQUEST_URI "\.(css|gif|jpg|js|html?)$" no-jk > > > > meaning that URI's for files starting with "/myapp" but ending in one of > the extensions above will /not/ be passed to Tomcat (but the rest will). ... and you can also use mod_rewrite to set the environment variable "no-jk", which disables mod_jk forwarding. > You can also add a second like > > > SetHandler none > > > > so that most things starting with "/myapp" will go to Tomcat, except the > ones starting with "/myapp/no-tomcat". > > And of course, you can use , , , > etc.. to similar effect. > > Which seems to me the kind of thing you want. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
J Channel wrote: [...] Hi. Let me jump in here for a while. First, I think it would be clearer (and certainly more efficient), to move your Rewrite rules away from a .htaccess file in docroot, and just put them in your main Apache configuration files. (I suppose that if you have access to the DocumentRoot, you have access to the server (or virtual server) *.conf, yes ?) Second, I personally find another syntax clearer than JkMount, specially when you need to combine it with other rules in Apache. The main reason is that indeed, it is not always very clear which kind of "priority" JkMount/JkUnMount directives have, vis-a-vis Apache Rewrite, etc.. So, for example, instead of writing JkMount /myapp workername JkMount /myapp/* workername you can also do it as follows : SetHandler jakarta-servlet This is explained here: http://tomcat.apache.org/connectors-doc/reference/apache.html in the section entitled : Using SetHandler and Environment Variables Basically, the section above means that anything corresponding to a URI starting with "/myapp" will be passed on to Tomcat. It is thus equivalent to the duo JkMount /myapp workername JkMount /myapp/* workername but, in my view, it gives you more flexibility at the Apache level, and also fits better with the Apache "way of things". I think it makes the respective priorities of mod_jk and RewriteRules clearer, because they are the same as what they are in Apache between Rewrite and blocks. For example, if you load the mod_setenvif module in Apache, you can exclude some URI's inside of that location using this kind of thing : SetHandler jakarta-servlet SetEnvIf REQUEST_URI "\.(css|gif|jpg|js|html?)$" no-jk meaning that URI's for files starting with "/myapp" but ending in one of the extensions above will /not/ be passed to Tomcat (but the rest will). You can also add a second like SetHandler none so that most things starting with "/myapp" will go to Tomcat, except the ones starting with "/myapp/no-tomcat". And of course, you can use , , , etc.. to similar effect. Which seems to me the kind of thing you want. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
I found that its work ok with httpd.conf like this: ... JkMount /app/* balancer JkUnMount /app/ntd/* balancer ... But this is not very well cause i need to add many exception pathes like this to httpd.conf :( I just need to have mod_rewrite directives with more priority than JkMount. Just like in apache1.3+mod_jk1.2.4 How can i tune this? > I send URL http://testsite.net/app/ntd/give?someparams=value > And i give a tomcat page "Sorry, we have no such page" instead of my > http://testsite.net/give.shtml?someparams=value page. > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
2009/4/11 Rainer Jung : > On 10.04.2009 23:24, J Channel wrote: >> 2009/4/11 Rainer Jung >>> On 10.04.2009 21:41, J Channel wrote: Hi!Apache 2.2.11, mod_jk 1.2.28 httpd.conf: LoadModule jk_module modules/mod_jk.so JkOptions +ForwardURICompat JkMount /app/* balancer LoadModule rewrite_module modules/mod_rewrite.so DocumentRoot /var/www/public_html .htaccess in docroot: RewriteEngine On RewriteCond %{QUERY_STRING} !dyn\=1 RewriteRule ^app/ntd/give.* give.shtml/?%{QUERY_STRING} [L] I cant get worked this conf on apache 2.2.11, URI http://server/app/ntd* pass to tomcat omitting RewriteRule. But its ok on apache1.3.33 + mod_jk1.2.14 (even whitout JkOptions +ForwardURICompat, AFAIK its enable by default for mod_jk <= 1.2.22). >>> It would be nice, if you would tell us, which URL you send, what you >>> expect to happen, and what happens instead. I send URL http://testsite.net/app/ntd/give?someparams=value And i give a tomcat page "Sorry, we have no such page" instead of my http://testsite.net/give.shtml?someparams=value page. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
On 10.04.2009 23:24, J Channel wrote: > 2009/4/11 Rainer Jung >> On 10.04.2009 21:41, J Channel wrote: >>> Hi!Apache 2.2.11, mod_jk 1.2.28 >>> >>> httpd.conf: >>> LoadModule jk_module modules/mod_jk.so >>> JkOptions +ForwardURICompat >>> JkMount /app/* balancer >>> LoadModule rewrite_module modules/mod_rewrite.so >>> DocumentRoot /var/www/public_html >>> >>> .htaccess in docroot: >>> RewriteEngine On >>> RewriteCond %{QUERY_STRING} !dyn\=1 >>> RewriteRule ^app/ntd/give.* give.shtml/?%{QUERY_STRING} [L] >>> >>> I cant get worked this conf on apache 2.2.11, URI http://server/app/ntd* >>> pass >>> to tomcat omitting RewriteRule. But its ok on apache1.3.33 + mod_jk1.2.14 >>> (even whitout JkOptions +ForwardURICompat, AFAIK its enable by default for >>> mod_jk <= 1.2.22). >> It would be nice, if you would tell us, which URL you send, what you >> expect to happen, and what happens instead. >> > > Now all URL under app/* just pass out to tomcat. > I expect redirection to give.shtml by RewriteRule as it works in > apache1.3 with same configuration. > >> General comments: >> >> - do not use any Forward JkOptions unless you are sure you need them and >> understand the implications. So I suggest you drop the respective line > > Ok, drop it, no changes. > >> - if you want mod_jk to be called even when mod_rewrite interfered with >> the URL, you need to add the PT flag to the rule (OT=pass through), so >> switch from "[L]", to "[L,PT]". > > I have no problem with pass through, i have problem with ignoring my > rewrite directives under /app/* So we are back to: >> It would be nice, if you would tell us, which URL you send, what you >> expect to happen, and what happens instead. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
2009/4/11 Rainer Jung > > On 10.04.2009 21:41, J Channel wrote: > > Hi!Apache 2.2.11, mod_jk 1.2.28 > > > > httpd.conf: > > LoadModule jk_module modules/mod_jk.so > > JkOptions +ForwardURICompat > > JkMount /app/* balancer > > LoadModule rewrite_module modules/mod_rewrite.so > > DocumentRoot /var/www/public_html > > > > .htaccess in docroot: > > RewriteEngine On > > RewriteCond %{QUERY_STRING} !dyn\=1 > > RewriteRule ^app/ntd/give.* give.shtml/?%{QUERY_STRING} [L] > > > > I cant get worked this conf on apache 2.2.11, URI http://server/app/ntd* > > pass > > to tomcat omitting RewriteRule. But its ok on apache1.3.33 + mod_jk1.2.14 > > (even whitout JkOptions +ForwardURICompat, AFAIK its enable by default for > > mod_jk <= 1.2.22). > > It would be nice, if you would tell us, which URL you send, what you > expect to happen, and what happens instead. > Now all URL under app/* just pass out to tomcat. I expect redirection to give.shtml by RewriteRule as it works in apache1.3 with same configuration. > General comments: > > - do not use any Forward JkOptions unless you are sure you need them and > understand the implications. So I suggest you drop the respective line Ok, drop it, no changes. > - if you want mod_jk to be called even when mod_rewrite interfered with > the URL, you need to add the PT flag to the rule (OT=pass through), so > switch from "[L]", to "[L,PT]". I have no problem with pass through, i have problem with ignoring my rewrite directives under /app/* - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteRule inside JkMount location
On 10.04.2009 21:41, J Channel wrote: > Hi!Apache 2.2.11, mod_jk 1.2.28 > > httpd.conf: > LoadModule jk_module modules/mod_jk.so > JkOptions +ForwardURICompat > JkMount /app/* balancer > LoadModule rewrite_module modules/mod_rewrite.so > DocumentRoot /var/www/public_html > > .htaccess in docroot: > RewriteEngine On > RewriteCond %{QUERY_STRING} !dyn\=1 > RewriteRule ^app/ntd/give.* give.shtml/?%{QUERY_STRING} [L] > > I cant get worked this conf on apache 2.2.11, URI http://server/app/ntd* pass > to tomcat omitting RewriteRule. But its ok on apache1.3.33 + mod_jk1.2.14 > (even whitout JkOptions +ForwardURICompat, AFAIK its enable by default for > mod_jk <= 1.2.22). It would be nice, if you would tell us, which URL you send, what you expect to happen, and what happens instead. General comments: - do not use any Forward JkOptions unless you are sure you need them and understand the implications. So I suggest you drop the respective line - if you want mod_jk to be called even when mod_rewrite interfered with the URL, you need to add the PT flag to the rule (OT=pass through), so switch from "[L]", to "[L,PT]". Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RewriteRule inside JkMount location
Hi!Apache 2.2.11, mod_jk 1.2.28 httpd.conf: LoadModule jk_module modules/mod_jk.so JkOptions +ForwardURICompat JkMount /app/* balancer LoadModule rewrite_module modules/mod_rewrite.so DocumentRoot /var/www/public_html .htaccess in docroot: RewriteEngine On RewriteCond %{QUERY_STRING} !dyn\=1 RewriteRule ^app/ntd/give.* give.shtml/?%{QUERY_STRING} [L] I cant get worked this conf on apache 2.2.11, URI http://server/app/ntd* pass to tomcat omitting RewriteRule. But its ok on apache1.3.33 + mod_jk1.2.14 (even whitout JkOptions +ForwardURICompat, AFAIK its enable by default for mod_jk <= 1.2.22).