ifiles
11 TopicsHow 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.2KViews0likes6CommentsMaintenance 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.1KViews0likes10CommentsSorryPage 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" } } } }837Views0likes25CommentsPowerShell - 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! /Per740Views0likes2CommentsMaintenance to ifile irule doesnt work
Hi Guys, I have a two sets of LTMs in datacenters (SEA and LHR). I need to setup a maintenance page in LHR datacenter to present a page when VIPs in SEA datacenters go down. I am pretty new to IRULEs but read through the guides for ifiles and irules and came up with a static way of setting the irule on a VIP: created a VIP on LHR LTMs created an a record for that VIP - x.x.x.x mapped to maintenance.x.com so that I can manually change a record to all domains I would like to point to ifile maint. page there... uploaded a simple htm file with maintenance note in to ifiles folder (through GUI so its in /common) named the ifile: maintenance_htm mapped the ifile to an ifile list in irule: maintance_htm created an irule (named maintenance_page) to catch all instances and subdomains of .x.com and redirect to my ifile: when HTTP_REQUEST { if { [HTTP::uri] contains ".x.com" } { HTTP::respond 200 content [ifile get maintance_htm ] }} added the IRULE to the maintenance.x.com VIP.... doesn't work... I spoke with support and was advised to add the path to the file itself: HTTP:Respond 200 ifile "/Common/ifileURL" but from what I understand if the file is already in /common you don't have to do it... when I add: HTTP:Respond 200 ifile "/Common/maintenance_htm" it through parser error at me anyway.... any advice how to troubleshoot this ?663Views0likes7CommentsUse 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 } }500Views0likes18CommentsServing 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?445Views0likes7CommentsHow 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?417Views0likes2CommentsBlock 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?381Views0likes8CommentsiControl 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?279Views0likes1Comment