ifiles
11 TopicsServing images via iRules from v11.1
Perhaps a better title would be "What Am I Missing?" I wanted to implement a Maintenance page for use when we have servers down for work. We're using BigIP v11.1. The first thing I found when searching the web was an article on RESDEV-OPS (http://www.resdevops.com/2013/01/25/hosting-maintenancesorry-site-from-a-f5-nlb/), which was essentially a version of this DevCentral article: https://devcentral.f5.com/wiki/iRules.LTMMaintenancePage.ashx. The author of the RESDEV-OPS piece mentioned some new capability in v11.1 over v10.x using iFiles, and since I didn't have his need to make it work on v10, I looked into that. This lead me to Jason Rahm's DevCentral very nice article on the subject (https://devcentral.f5.com/articles/v111-ndashexternal-file-access-from-irules-via-ifiles) which outlined the use of iFiles for this purpose. This seemed a lot simpler, so I worked up a similar solution for my page. My maintenance page is quite simple; it just displays some text and an image. Here is the iRule: when HTTP_REQUEST { set VSPool [LB::server pool] if { [active_members $VSPool] < 1 } { log local0. "Client [IP::client_addr] requested [HTTP::uri] no active nodes available..." if { [HTTP::uri] eq "/x_logo.png" } { HTTP::respond 200 content [ifile get maint_logo_img] "Content-Type" "image/png" } else { HTTP::respond 200 content " Please Excuse Our Absence PeopleSoft at the Org X is currently down for maintenance. We promise to be back online soon, though. For more information, see our . Thank you for your patience! " } } } Great so far. The image was uploaded to the F5 using the procedure in Jason Rahm's article, and is referenced as the iFile maint_logo_image. After attaching this to a test virtual server, and turning off the pool members attached to it, indeed the page comes up. All except for the image. The effect is different for different browsers. Chrome will try to show the image. If you keep refreshing, the image will show transiently as the page loads. Many times it will show a blurred or highly pixellated version of the image if I go to the /x_logo.png URL. Firefox usually will not show the image under any circumstances, but will transiently show an error message saying "there were errors in the image and it couldn't be displayed". IE actually will attempt to render the image, and gets about 30% of it. So in IE, I see a truncated image, or a highly pixellated image. Here's an example from IE: This leads me to believe that there's something wrong with the image or with the way I uploaded it to the F5. I even got so desperate that I took F5's advice and redid the way I presented the images according to the 10.x article, base64-encoding the image into a class datagroup. No dice. I got similar results. I have tried other images, with similar results as well. It seems pretty obvious that I'm doing something wrong here, but I can't figure out what it is from the sources that I have looked at. Has anyone out there had similar issues, or does anyone have an idea as to what might be wrong?455Views0likes7CommentsMaintenance page using iFiles
Hi, I'm trying to setup a maintenance page using iFiles. I have gone through the below link and configured iFiles, iFiles List and created an irule as mentioned below, https://devcentral.f5.com/articles/v111-ndashexternal-file-access-from-irules-via-ifiles iRule: when HTTP_REQUEST { if { [HTTP::uri] eq "/" } { HTTP::respond 200 content [ifile get api_asia_html] } else { discard } } However, after attaching the above iRule I cannot access the virtual server as it gets timed out. Not sure if I'm missing something in my irule, which calls an html page with images already embedded. Can anyone please verify my irule and let me know what I'm missing, so that anyone accessing this virtual server should see maintenance window page. Thanks in advance, MSKSolved1.1KViews0likes10CommentsPowerShell - How to modify system iFile?
I use PowerShell to upload a text file containing a number of parameters that I want to use in an existing iRule. Through the web-gui I have already created an iFile named 'iFileApiKeys'. In PowerShell I use this procedure to upload the text file: $length = "0-" + ($fileContent.Length - 1) + "/" + $fileContent.Length $headers = @{ "Content-Range" = $length} $uploadResult = Invoke-WebRequest $URL -Method POST -Headers $headers -InFile $filePathPlusTextfile - ContentType "multipart/form-data" -TimeoutSec 20 -Credential $mycreds | ConvertFrom-Json Write-Host "Upload Result:" Write-Host $uploadResult According to the 'uploadResult' the file ends up in the folder:'var/config/rest/downloads/iFileApiKeys.txt' on my F5 LTM Using 'SuperPutty' I can via tmos (tmsh) modify the existing system iFile by executing: `tmos> modify /sys file ifile iFileApiKeys source-path file:///var/config/rest/downloads/iFileApiKeys.txt My problem is that I can't seem to find the correct PowerShell command to achieve the same result as the tmos (tmsh) command does. I want to use and actually think I should use: `Invoke-Webrequest -Method Put` I've been trying to emulate an example taken from a Jason Rahm post on this site: https://devcentral.f5.com/articles/getting-started-with-icontrol-working-with-the-system-20592 Like this: $sysIfilePath = "/mgmt/tm/sys/file/ifile/iFileApiKeys" `$sysPath = "https://" + $host_address + $sysIfilePath $updateresult = Invoke-WebRequest -Method Put -Uri $sysPath -Headers $headers -Credential $mycreds -Body $body But this command fails unfortunately, My assumption is that I don't fill $headers and/or $body with the correct values. When executing a GET for my sys iFile object the result is: ``{"kind":"tm:sys:file:ifile:ifilestate","name":"iFileApiKeys","fullPath":"iFileApiKeys","generation":10970077,"selfLink":"https://localhost/mgmt/tm/sys/file/ifile/iFileApiKeys?ver=13.1.0.2","chec ksum":"SHA1:878:52a261b5a113db5c9421a54e1e8b5685e7da7a4d","createTime":"2018-11-26T22:52:08Z","createdBy":"per.eriksson","lastUpdateTime":"2018-12-08T19:49:15Z","mode":33188,"revision":24,"size" :878,"sourcePath":"file:///var/config/rest/downloads/iFileApiKeys.txt","updatedBy":"per.eriksson"} Anyone out there that can point me in the right direction on how to update my sys iFile using PowerShell? Thank you! /Per760Views0likes2CommentsHow to create iRule to respond with Maintanence Page for HTTPS site
I have created a maintenance page using html - iFile configurations as below: when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1} { switch [string tolower [HTTP::uri]] { "/" { HTTP::respond 200 content [ifile get Maintenance] "Content-Type" "text/html" } "/logo.png" { HTTP::respond 200 content [ifile get logo] "Content-Type" "image/png" } "/background-pattern.png" { HTTP::respond 200 content [ifile get background-pattern] "Content-Type" "image/png" } } } } It works great with HTTP Site, no problem there. But when I apply same iRule to VS running HTTPS service, it fails to generate the sorry page. I am doing SSL Bridging, and not offloading ( This cant be changed to offloading). It works when I opt for offloading though. It would be a great help if anyone could make it working for HTTPS site with SSL Bridging enabled.1.2KViews0likes6CommentsSorryPage with iFiles on 11.3 HF8
Here is my problem, I have uploaded files via "System ›› File Management : iFile List" , created references under "Local Traffic ›› iRules : iFile List" , wrote an iRule for maintenance page and ttached iRule to one of my virtual servers, however it seems that pictures are not loaded at all. Can you have a look and tell me what can be wrong (although all looks ok to me). All object names and file names are exactly the same to avoid mistakes or typeos in code iRule code : when HTTP_REQUEST { log local0. "HTTP_REQ: Requested Hostname: [HTTP::host] URI: [HTTP::uri]" if { [HTTP::uri] eq "/sp" } { switch [HTTP::uri] { "/sp" { HTTP::respond 200 content [ifile get "index"] "Content-Type" "text/html" } "/logo" { HTTP::respond 200 content [ifile get "logo"] "Content-Type" "image/png" } "/background" { HTTP::respond 200 content [ifile get "background"] "Content-Type" "image/jpeg" } } } }856Views0likes25CommentsUse iFile to when only TLS1.0 is being used.
I want to display a custom message to people who are using only TLS1.0 in their browsers as to why they cannot access the website. I used the code below to attempt to do what I wanted after uploading the ifile to the BigIP. Unfortunately I am still able to access the website when testing and am not redirected to the ifile. How can I redirect users based on their TLS settings? Thanks! when HTTP_REQUEST { if { not ([SSL::cipher version] starts_with "TLSv1.") } { HTTP::respond 200 content [ifile get message.html] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" Connection Close } }500Views0likes18CommentsHow to overwrite iFileFile with iControlREST
I have uploaded files to F5 with iControlRest using "/mgmt/shared/file-transfer/uploads/" first and then "/mgmt/tm/sys/file/ifile" and now I want to overwrite them. The first method lets overwrite the file but the second one ("/mgmt/tm/sys/file/ifile") don't. I have tried with PUT but the response is "Operation is not supported on component /sys/file/ifile". Could you tell me how I can overwrite this?428Views0likes2Commentshosting maintenance page via ifile utilizing an irule
I am searching for a solution to an issue a customer has presented. They would like to have a maintenance splash page that will external users will hit when all pool members are down but still allow external users to have access. for a simple "sorry, this page is down for maintenance" page, what files or what kind would need to be referenced within the ifiles. I am very green on iRules and am searching for an irule I can utilize for this. do I need to specify the LB pools within the rule? or can it be a generic irule that when applied to a VS performs this function? F5 has so many capabilities its hard to keep up and learn the ins and outs on the fly. any and all help is always appreciated, thank you!251Views0likes2CommentsBlock Source IP using a blocklist hosted on a webserver
Currently we utilize a web server to host a blocklist that some of our other security devices use to block IP addresses. It allows us to maintain 1 list for all devices. Can the F5 ASM or LTM utilize such a list...maybe through an iRule or iFile?393Views0likes8CommentsiControl iFileFile Issue
Hey all. I've tried using both Puppet and a simple curl request to create iFileFile objects without success. In both cases the iFileFile creation call appears to be successful, but the object is not created. Anyone else come up against this? Better yet, overcome it?283Views0likes1Comment