ReWriteMap

Fix it!!

ReWriteMap

Postby kiransarv » Tue Oct 14, 2008 6:28 am

Hi all,

I have a piece of code

servers.conf
FINAL 172.16.31.51:8080|172.16.31.49:8080

Rewritemap servers rnd:/usr/local/httpd/conf/servers.conf
RewriteRule ^/image/?file=(.*)$ http://${servers:FINAL}/upload/$1

servers.conf has two tomcat machines which does the same thing.To balance load i have created servers.conf. Now every http request of pattern /image?file="XYZ" will go to one of the machines in round robin fashion. Suppose if one of the machine is down due to some reasons or it is unable to upload the file. It is not giving any response. Then i automatically need to pass the request to the other server after a certain timeout...how can i do this??. Also How can i pass the request to two machines simultaneously (parallelism).
kiransarv
 
Posts: 1
Joined: Tue Oct 14, 2008 5:02 am

Postby richardk » Tue Oct 14, 2008 9:19 am

Suppose if one of the machine is down

You could try checking if the server is available
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteMap servers rnd:/usr/local/httpd/conf/servers.conf

RewriteCond ${servers:FINAL} ^(.+)$
RewriteCond http://$1/ -U
RewriteRule ^/image/?file=(.*)$ http://%1/upload/$1 [L]


unable to upload the file

I don't think you can catch that error with mod_rewrite. Is the browser address bar changing?

Also How can i pass the request to two machines simultaneously (parallelism).

I don't think you can do that, either.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

cron