Re: Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?

2009-05-21 Thread Rainer Jung
On 20.05.2009 10:52, Imner, Andreas wrote:
 Hi all
 
 I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 
 (Windows Server 2000) that connects to two 
 backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load 
 balancing. 
 The webserver also uses mod_proxy to forward some requests to an IIS5 server 
 running on the same server but on a 
 different port. 
 The IIS5 hosts an Episerver 3 installation.
 
 To speed things up, Apache webserver is serving the /images folder used by 
 Episerver using an Alias directive
 
 Alias /images E:/Inetpub/EPiServer3/root/images
 Directory E:/Inetpub/EPiServer3/root/images
   Order deny,allow
   Allow from all
 /Directory
 
 For mod_jk, the uriworkermap.properties -file specifies that all requests to 
 /images/... should be sent to 
 Apache Tomcat since the webapp contains a lot of images with that path
 
 /images/*=wlb
 
 
 Is there some way to achieve any of the following behaviours?:
 
 1.A request for /images/logo.jpg is processed by Apache webserver (This 
 file is located on the Apache webserver, in
   E:/Inetpub/EPiServer3/root/images)
 2.Mod_jk forwards the request to an Apache Tomcat server which returns a 
 404 since logo.jpg does not exist
   on the server
 3.Apache webserver detects this 404 response and fetches logo.jpg from 
 E:/Inetpub/EPiServer3/root/images and returns it
 
 Alternative
 
 1.Same as above
 2.Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images
 (3.   In the case that logo.jpg is not found in 
 E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to 
   the Apache Tomcat server using mod_jk)
 
 I have done some research and came accross the mod_jk option 
 ForwardDirectories but it doesnt seem to handle any of the above
 scenarios? It seems more related to directory indexing?! (I'm quite new with 
 Apache Webserver / Apache Tomcat :-) )
 
 Thank you for your attention!

mod_rewrite has a builtin -f flag for does file exist. You can use
it to implement solution 2.

1) Use mod_rewrite to deliver from disk if file exists
2) use mod_rewrite to set the environment variable JK_WORKER_NAME to the
name of the jk worker you want to handle the request in case the file
does not exist. Also set the mod_rewrite PT (pass through) flag in this
case.
3) Do not use an overlapping JkMount. If there is no JkMount for a
request and JK_WORKER_NAME is set, the worker name will be taken from
the variable.

The solution is not easy to understand for administrators, and it is
hard to debug, because you would have to know what was in the file
system at which time to understand what was going on for some request in
the past.

To set it up correctly and debug your setup, use a log file for
mod_rewrite with a high log level. Firs check independently how the -f
in mod_rewrite works, then see how you can use the JK_WORKER_NAME
environment variable and PT, then combine things.

Have fun.

Rainer

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



Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?

2009-05-20 Thread Imner, Andreas
Hi all

I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 (Windows 
Server 2000) that connects to two 
backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load balancing. 
The webserver also uses mod_proxy to forward some requests to an IIS5 server 
running on the same server but on a 
different port. 
The IIS5 hosts an Episerver 3 installation.

To speed things up, Apache webserver is serving the /images folder used by 
Episerver using an Alias directive

Alias /images E:/Inetpub/EPiServer3/root/images
Directory E:/Inetpub/EPiServer3/root/images
Order deny,allow
Allow from all
/Directory

For mod_jk, the uriworkermap.properties -file specifies that all requests to 
/images/... should be sent to 
Apache Tomcat since the webapp contains a lot of images with that path

/images/*=wlb


Is there some way to achieve any of the following behaviours?:

1.  A request for /images/logo.jpg is processed by Apache webserver (This 
file is located on the Apache webserver, in
E:/Inetpub/EPiServer3/root/images)
2.  Mod_jk forwards the request to an Apache Tomcat server which returns a 
404 since logo.jpg does not exist
on the server
3.  Apache webserver detects this 404 response and fetches logo.jpg from 
E:/Inetpub/EPiServer3/root/images and returns it

Alternative

1.  Same as above
2.  Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images
(3. In the case that logo.jpg is not found in 
E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to 
the Apache Tomcat server using mod_jk)

I have done some research and came accross the mod_jk option ForwardDirectories 
but it doesnt seem to handle any of the above
scenarios? It seems more related to directory indexing?! (I'm quite new with 
Apache Webserver / Apache Tomcat :-) )

Thank you for your attention!

Best Regards
/Andreas Imner




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



Re: Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?

2009-05-20 Thread Pid
Imner, Andreas wrote:
 Hi all
 
 I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 
 (Windows Server 2000) that connects to two 
 backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load 
 balancing. 
 The webserver also uses mod_proxy to forward some requests to an IIS5 server 
 running on the same server but on a 
 different port. 
 The IIS5 hosts an Episerver 3 installation.
 
 To speed things up, Apache webserver is serving the /images folder used by 
 Episerver using an Alias directive
 
 Alias /images E:/Inetpub/EPiServer3/root/images
 Directory E:/Inetpub/EPiServer3/root/images
   Order deny,allow
   Allow from all
 /Directory
 
 For mod_jk, the uriworkermap.properties -file specifies that all requests to 
 /images/... should be sent to 
 Apache Tomcat since the webapp contains a lot of images with that path
 
 /images/*=wlb

So the short version is that you have two images directories, with the
same external path and you want overlapping mappings?

Inventing some complex solution to resolve it seems like a poor choice
to me.  If you have control of one or either of the applications I'd
adjust the path to the images instead.

Otherwise you're probably looking at individually mapping each image
file, which would be tedious.

A simple solution will be better in the long run.

p



 Is there some way to achieve any of the following behaviours?:
 
 1.A request for /images/logo.jpg is processed by Apache webserver (This 
 file is located on the Apache webserver, in
   E:/Inetpub/EPiServer3/root/images)
 2.Mod_jk forwards the request to an Apache Tomcat server which returns a 
 404 since logo.jpg does not exist
   on the server
 3.Apache webserver detects this 404 response and fetches logo.jpg from 
 E:/Inetpub/EPiServer3/root/images and returns it
 
 Alternative
 
 1.Same as above
 2.Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images
 (3.   In the case that logo.jpg is not found in 
 E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to 
   the Apache Tomcat server using mod_jk)
 
 I have done some research and came accross the mod_jk option 
 ForwardDirectories but it doesnt seem to handle any of the above
 scenarios? It seems more related to directory indexing?! (I'm quite new with 
 Apache Webserver / Apache Tomcat :-) )
 
 Thank you for your attention!
 
 Best Regards
 /Andreas Imner
 
 
 
 
 -
 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



SV: Making Apache httpd fallback to local file after receiving 404 from backend Tomcat?

2009-05-20 Thread Imner, Andreas
 
Thanks for the reply and the thoughts about my question. 



Med vänlig hälsning
Andreas Imner
Systemutvecklare 
KG Knutsson AB
Autokatalogen

Tel: +46 8 92 34 37
Mobil: +46 70 606 34 37
andreas.im...@kgk.se 



-Ursprungligt meddelande-
Från: Pid [mailto:p...@pidster.com] 
Skickat: den 20 maj 2009 11:14
Till: Tomcat Users List
Ämne: Re: Making Apache httpd fallback to local file after receiving 404 from 
backend Tomcat?

Imner, Andreas wrote:
 Hi all
 
 I'm setting up a website using Apache webserver 2.2.11 / mod_jk 1.2.28 
 (Windows Server 2000) that connects to two 
 backend Apache Tomcat 6.0.18 server (Windows Server 2003) with load 
 balancing. 
 The webserver also uses mod_proxy to forward some requests to an IIS5 server 
 running on the same server but on a 
 different port. 
 The IIS5 hosts an Episerver 3 installation.
 
 To speed things up, Apache webserver is serving the /images folder used by 
 Episerver using an Alias directive
 
 Alias /images E:/Inetpub/EPiServer3/root/images
 Directory E:/Inetpub/EPiServer3/root/images
   Order deny,allow
   Allow from all
 /Directory
 
 For mod_jk, the uriworkermap.properties -file specifies that all requests to 
 /images/... should be sent to 
 Apache Tomcat since the webapp contains a lot of images with that path
 
 /images/*=wlb

So the short version is that you have two images directories, with the
same external path and you want overlapping mappings?

Inventing some complex solution to resolve it seems like a poor choice
to me.  If you have control of one or either of the applications I'd
adjust the path to the images instead.

Otherwise you're probably looking at individually mapping each image
file, which would be tedious.

A simple solution will be better in the long run.

p



 Is there some way to achieve any of the following behaviours?:
 
 1.A request for /images/logo.jpg is processed by Apache webserver (This 
 file is located on the Apache webserver, in
   E:/Inetpub/EPiServer3/root/images)
 2.Mod_jk forwards the request to an Apache Tomcat server which returns a 
 404 since logo.jpg does not exist
   on the server
 3.Apache webserver detects this 404 response and fetches logo.jpg from 
 E:/Inetpub/EPiServer3/root/images and returns it
 
 Alternative
 
 1.Same as above
 2.Apache webserver returns logo.jpg from E:/Inetpub/EPiServer3/root/images
 (3.   In the case that logo.jpg is not found in 
 E:/Inetpub/EPiServer3/root/images, an attempt is made to send the request to 
   the Apache Tomcat server using mod_jk)
 
 I have done some research and came accross the mod_jk option 
 ForwardDirectories but it doesnt seem to handle any of the above
 scenarios? It seems more related to directory indexing?! (I'm quite new with 
 Apache Webserver / Apache Tomcat :-) )
 
 Thank you for your attention!
 
 Best Regards
 /Andreas Imner
 
 
 
 
 -
 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