Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Using external web page to determine rewrite condition |
|
Author |
|
Ropeguru
Joined: 26 Jun 2014 Posts: 12 Location: USA, Richmond
|
Posted: Wed 11 Mar '15 17:11 Post subject: Using external web page to determine rewrite condition |
|
|
I am looking for a way to put a rewrite condition into my configuration where I can poll an external web page and based on the http status code, allow the rewrite or not.
I am doing this in order to set a maintenance status on two different proxy servers, one is apache the other is a big-ip. I already have the maintenance pages and control setup on the big-ip, but I need a way to poll a url and pull a specific http status code served up by the big-ip.
I have tried searching but cannot find anything like I am looking for.
Thanks |
|
Back to top |
|
weyerma
Joined: 21 Mar 2015 Posts: 3 Location: Switzerland
|
Posted: Sun 22 Mar '15 3:49 Post subject: |
|
|
Try a condition:
RewriteCond %{HTTP:X-Maintenance} ^active$ [NC]
RewriteRule ^.*$ /system/maintenance.html [L]
(If Header X-Maintenance has value "active") |
|
Back to top |
|
Ropeguru
Joined: 26 Jun 2014 Posts: 12 Location: USA, Richmond
|
Posted: Mon 23 Mar '15 15:48 Post subject: |
|
|
So how do I write the portion that actually checks for the header from a page on a different server?
I understand the concept of the rewrite condition you proposed. |
|
Back to top |
|
weyerma
Joined: 21 Mar 2015 Posts: 3 Location: Switzerland
|
Posted: Tue 24 Mar '15 10:06 Post subject: |
|
|
Ah.. .ok i dont realized the check from a different server..
So you can run a external script with curl, which place a file anywhere and check for it with a condition:
RewriteCond /var/www/filename.xxx -f |
|
Back to top |
|
|
|
|
|
|