Forum Discussion
cwat_115731
Nimbostratus
Jun 24, 2013json & jpg in irule
Hi,
target : make a maintenance page by the F5.
I have a maintenance page on json language. I try to make an irule in differents ways but it doesn't work :
- by stream::expression
- by ifile (get ifile with the .json)
Here is a peace of my irule :
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
HTTP::respond 503 content
STREAM::expression{@@"json_script_here"}
STREAM::enable
}
}
Or :
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
HTTP::respond 503 content
ifile get my_json_file.json "Content-Type" "application/json" "Cache-Control" "no-cache"
}
}
6 Replies
- nitass
Employee
can you try this?when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { HTTP::respond 503 content [ifile get my_json_file.json] "Content-Type" "application/json" "Cache-Control" "no-cache" } } - cwat_115731
Nimbostratus
Yes,
the browser displays the json code :( - Kevin_Stewart
Employee
I'm assuming the JSON data is some content *within* an HTML file, or called from an HTML file? If so, do you need to replace the HTML content completely, or just the referenced JSON? The 503 response you're trying to respond with needs to be HTML content for the browser to render. - cwat_115731
Nimbostratus
It's a .json file.
I will try to do this with an html file including the json script - Kevin_Stewart
Employee
You can still call the JSON file separately, as an object referenced by the HTML, but the browser needs something that it can render. - cwat_115731
Nimbostratus
Posted By nitass on 06/24/2013 06:16 AM
can you try this?when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1 } { HTTP::respond 503 content [ifile get my_json_file.json] "Content-Type" "application/json" "Cache-Control" "no-cache" } }Hi,
It seems that the right way. The code is display by a specific application.
Thanks for support 🙂
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects