Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite

Using mod_rewrite to call images from different server

         

jmabee

3:12 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



I am in the process of migrating our apache servers. Previously, our apache server was operation on the same server as web logic. Our web applications that are served by weblogic. How do I serve the images when the apache is on a different unix box. Previously we had set the image directories by
using alias statements (see example below). But my understanding is that you cannot do this if the images are not on the same box as the apache. I have heard that mod_rewrite may be able to accomplish this. Does anyone have any ideas how to configure this?

<VirtualHost 198.XX.XXX.XX:80 >

Servername test1.mysite.com
DocumentRoot "/www/staging/htdocs/server1"
CustomLog /www/staging/apache/logs/test1_access_log combined
ErrorLog /www/staging/apache/logs/test1_error_log
Alias /client1/pdf /www/staging/webjobs/client1/pdfs
Alias /client1/images/thumbnails /www/staging/webjobs/client1/images

jdMorgan

3:33 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jmabee,

Welcome to WebmasterWorld!

See Apache mod_proxy and the [P] flag for RewriteRule in mod_rewrite.

Jim

jmabee

6:08 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



I found some documentation. Can I use either the mod_proxy or the mod_rewrite? Or do I need to the mod_rewrite which seems to use mod_proxy? For example, it appears as if the mod_proxy may work but I am not sure. Here is what I am thinking if I use the mod_proxy. In this configuration testfiles.mysite.com would resolve to the server containing the images.

<VirtualHost 19x.#*$!.xxx.xx:80>

ProxyRequests off

Proxypass /client1/fdm [testfiles.mysite.com...]
ProxyPass /client1/images/thumbnails [testfiles.mysite.com...]

Servername test1.mysite.com
DocumentRoot "/www/staging/htdocs/server1"
CustomLog /www/staging/apache2/logs/test1_access_log combined
ErrorLog /www/staging/apache2/logs/test1_error_log

# By default, all requests are directed to WL

<Location /client/pdf/>
ProxyPassReverse /
</Location>

<Location /client1/images/>
ProxyPassReverse /
</Location>

jdMorgan

7:00 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the resources you want to proxy to the other server are all well-organized, then you can just use mod_proxy. If you need to conditionally proxy various individual pages, then you'd need to use mod_rewrite. Since you material is organized by directory and you don't need any conditional functions, you should be able to do it with just mod_proxy directives.

Jim

jmabee

7:25 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



THank you so much for your help. It is much appreciated!

Jim