Forum Discussion

Srini_Vaiyapuri's avatar
Srini_Vaiyapuri
Icon for Nimbostratus rankNimbostratus
Dec 01, 2015

Need help with Irule

Hello,

 

I am working on VIP (both http & https) where https assigned with 2 Irule, first Irule is attached below which works fine. The problem is when I assign the 2nd Irule (Maintenance window), URL is not working. But both the Irule's works individually without any issue.

 

When I have both the Irule assigned to the https VIP, below 2 URLs works but client requirement is to make this https://mstrdevl.us.xxxxxxx.com work which seems never work.

 

https://mstrdevl.us.xxxxxxx.com/MicroStrategy---------------- Works

 

https://mstrdevl.us.xxxxxxx.com/MicroStrategy/servlet/mstrWeb -------------- Works

 

Note: http vip got another http to https redirect irule assigned. This is Dev VIP so I can make changes immediately based on suggestion.

 

Any help would be greatly appreciated.

 

First Irule:

 

when HTTP_REQUEST { if { (([IP::addr [IP::client_addr]/8 equals 10.0.0.0]) or ([IP::addr [IP::client_addr] equals x.x.x.x]) or ([IP::addr [IP::client_addr] equals x.x.x.x])) and ([HTTP::uri] starts_with "/manager")}{ return } elseif { not ([HTTP::uri] starts_with "/MicroStrategy") }{ HTTP::redirect "https://mstrdevl.us.xxxxxxx.com/MicroStrategy/servlet/mstrWeb" } }

 

Second Irule

 

when HTTP_REQUEST {

 

Change the following to set schedule

set maintenance_start_time "1317"; set maintenance_end_time "1600"; set maintenance_day "Tuesday";

 

Get time in seconds, formatted as day of week (%A) hour (%k) minute (%M) Use scan to save output as $cur_day $cur_hour $cur_minute

scan [clock format [clock seconds] -format {%A %k %M}] {%s %s %s} cur_day cur_hour cur_minute set cur_time ${cur_hour}${cur_minute} log local0. "\$cur_day: $cur_day, \$cur_hour: $cur_hour, \$cur_minute: $cur_minute, \$cur_time: $cur_time"

 

if { ($cur_day eq $maintenance_day) && ($cur_time >= $maintenance_start_time) && ($cur_time <= $maintenance_end_time) } { HTTP::respond 200 content " Site Maintenance

 

text=800517>

 

 

 

 

 

 

 

 

MSTR is temporarily unavailable.

 

 

 

Site will be available again at 2:00am.

 

 

We are sorry for any inconvenience. "

 

 

} }

 

2 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Srini,

     

    Without getting into the details of what the irules are doing specifically, you could always add a Priority value to each. The lower the value the higher the priority. So iRule one could be priority 100 and iRule two could be priority 500, for example.

     

    See the following for an explanation from far better iRule gurus than me:iRules 101 - Events & Priorities

     

    Hope this helps,

     

    N

     

  • Hi Srini,

     

    it seems for me that your code may trigger the redirect from "/" to "/MicroStrategy/servlet/mstrWeb" and outputs the maintenance page on a single HTTP request. This will lead to "Multiple redirect/respond invocations" and raises an error.

     

    Take a look into you LTM log and keep an eye on "Multiple redirect/respond invocations..." messages. If this is your problem, than make sure that the first iRule informs the second iRule that the given request is already responded. Alternativly put the code into y single iRule and "return" the processing after each individual response.

     

    Cheers, Kai