html - Riverbed Stingray steelapp, displaying a image on a maintenance page -
we have setup our application on riverbed stingray, 1 of requirement display maintenance page when administrator wants update system.
so created html page logo image , uploded both .html , .png image file/ miscellaneous path. created rule, in rule added below trafficscript has hardcoded html file name uploaded miscellaneous path. , when try access website displays maintenance page, image added in maintenance page not displayed. if dont hardcode .html file name use http.getpath() , file name , use navigation(commented in script), image displayed fine.
if can please point me if there problem or if there better way this.
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>sorry</title> </head> <body> <img src="/.extra/test.png"> <h1>our apologies</h1> we're sorry. of our operators busy. please try again later. </body> </html>
the trafficscript
#$url = http.getpath(); #if( ! string.regexmatch( $url, "^/\\.extra/(.*)$" ) ) { # break; #} else { # $file = $1; #} $file = "app_offline.html"; # if file not exist, stop if( ! resource.exists( $file ) ) break; # serve file conf/extra directory $contents = resource.get( $file ); http.sendresponse( "200 ok", "text/html", $contents, "" );
i able display image on html page , navigate traffic page when rule enabled. modified trafficscript below
$url = http.getpath(); if( ! string.regexmatch( $url, "^/\\.extra/(.*)$" ) ) { http.setpath("/.extra/app_offline.html"); } $url = http.getpath(); if( ! string.regexmatch( $url, "^/\\.extra/(.*)$" ) ) { break; } else { $file = $1; } # if file not exist, stop if( ! resource.exists( $file ) ) break; $mimes = [ "html" => "text/html", "jpg" => "image/jpeg", "jpeg" => "image/jpeg", "png" => "image/png", "gif" => "image/gif", "js" => "application/x-javascript", "css" => "text/css" , "ico" => "image/x-icon" , "txt" => "text/plain" ]; if( string.regexmatch( $file , ".*\\.([^.]+)$" ) ) { $mime = $mimes[ $1 ]; } if( ! $mime ) $mime = "text/html"; # serve file conf/extra directory $contents = resource.get( $file ); http.sendresponse( "200 ok", $mime , $contents, "" );
Comments
Post a Comment