Want to display a maintenance page from the F5 using ifile + irule and no cache.

Hi experts, we are running ver 11.5.1 hf3 on our LTMs. I am using the ifile feature to send out a maintenance page by using the below irule -

when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { HTTP::respond 200 content [ifile get MY-HTML-IFILE] } }

My problem is, i want to insert the no cache, no store headers with it to avoid any kind of caching on the browsers. When i add this line in the irule and test, it breaks the VS - HTTP::header insert Cache-Control “no-store, no-cache”

How can i accomplish this?

HTTP::header insert

in the HTTP_REQUEST event inserts the headers in the request before passing the request to the forwarding target (generally a pool member). Since you are not passing the request along, that’s not quite what you want.

The HTTP::respond command allows you to insert headers directly on the response:

when HTTP_REQUEST {
    if { [active_members [LB::server pool]] < 1 } {
        HTTP::respond 200 content "[ifile get MY-HTML-IFILE]" noserver "Cache-Control" "no-store, no-cache"
    } 
}
HTTP::header insert

in the HTTP_REQUEST event inserts the headers in the request before passing the request to the forwarding target (generally a pool member). Since you are not passing the request along, that’s not quite what you want.

The HTTP::respond command allows you to insert headers directly on the response:

when HTTP_REQUEST {
    if { [active_members [LB::server pool]] < 1 } {
        HTTP::respond 200 content "[ifile get MY-HTML-IFILE]" noserver "Cache-Control" "no-store, no-cache"
    } 
}

Thanks… that works !! You are bang on target !!

Thanks… that works !! You are bang on target !!