Forum Discussion
Irule error-Command not valid in the current scope
This maybe? But I think you'll want to do your "[clock format [expr ([clock seconds]+$expire_content_timeout)] -format "%a, %d %h %Y %T GMT" -gmt true]" after the if, set it as a variable and then place the variable inside the HTTP::header replace.
when HTTP_REQUEST {
if {[HTTP::method] eq "GET" and [HTTP::uri] eq "/"}{
set expire_content_timeout 300
} else {
set expire_content_timeout [findclass [string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]] static_cache_24hrs " "]
}
}
when HTTP_RESPONSE {
if { $expire_content_timeout ne "" } {
HTTP::header replace "Cache-Control" "max-age=$expire_content_timeout, public" HTTP::header replace "Expires" "[clock format [expr ([clock seconds]+$expire_content_timeout)] -format "%a, %d %h %Y %T GMT" -gmt true]"
} else {
HTTP::header replace "Cache-Control" "private"
HTTP::header replace "Expires" "-1"
}
}
This one didn't work too.
01070151:3: Rule [/Common/shop_lkqcorp_cache_expiry] error: /Common/shop_lkqcorp_cache_expiry:11: error: [wrong args][HTTP::header replace "Cache-Control" "max-age=$expire_content_timeout, public" HTTP::header replace "Expires" "[clock format [expr ([clock seconds]+$expire_content_timeout)] -format "%a, %d %h %Y %T GMT" -gmt true]"
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com