irule
642 TopicsAPM URL Branching tolower
Hello Folks, Situation is: I've a Per-Request-Policy with URL Branching for specific URL to activate a 2 FA. -> this is working. Problem: URL Branching is only working with a exact matching URI's => case sensitive e.g. URL Branch: /path/path123 -> incoming request -> /path/path123/ -> 2FA working -> incoming request -> /path/Path123/ -> 2FA is bypassed Is there any possibility in APM to change all incoming requests to lower case with an in-build-function (only for URL Branch checking)? Current workaround would be an iRule to convert all URI's to lower case. I have no idea whether this is always a good idea (maybe the backend can't handle case - insensitive paths). Thanks a lot. R.Solved49Views0likes2CommentsReplace stream if condition is met
Hi - I have an iRule i need to draft, however I can only test it once it drafted, by sending it to my customer for testing... bummer. So the problem is - I need to inject my .js in the body of the response, but only if the script is not already injected (there is a valid reason for this, I promise). My thinking process is based on this: https://clouddocs.f5.com/api/irules/STREAM_MATCHED.html The goal is: 1) Check if the body contains /js/app<10digits>.js 2) If it does - do nothing 3) If it does not inject /js/app.js just before closing </body> tag or: 2) delete the /js/app<10 digits>.js 3) Insert /js/app.js just before closing </body>tag I'm thinking option 2 might be simpler, please let me know if my thinking is good, and If possible suggest some more elegant solution when HTTP_REQUEST { STREAM::disable HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { if { [HTTP::header exists "Content-Type"] && [HTTP::header value "Content-Type"] contains "text/html" } { if { [HTTP::header exists "Content-Length"] } { HTTP::header remove "Content-Length" } STREAM::expression { =<script type="text/javascript" src="/secfense/js/eru-[0-9]{10}\.js"><\/script><\/body>== @</body>@<script type="text/javascript" src="/secfense/js/eru-1744029915.js"></script></body>@ } STREAM::enable } I'm not sure whether multi expression STREAM::expression is a thing... Will this work?69Views0likes3CommentsSNI Sites not taking correct certificate.
I have configured one VIP with two certificate aks.test.com aks4.test.com On SSL profile for aks.test.com i have enabled SNI feature and aks.test.com is working fine taking correct certificate (aks.test.com). but aks4.test.com having not secure error on browser and taking the certificate of (aks.test.com). Could someone please help what could be the issue in this case.143Views0likes8CommentsPersistent hash iRule
Hi All, I have a question regarding the Persistent hash iRule. Two Pool members are configured as Round robin. Sessions have been concentrated as one pool member since we added the Persistent hash iRule below to the virtual server. There are two Client IPs in total and have not changed since iRule was applied. What is the reason? Please help me. <Pool member#1 connection> <Pool member#2 connection> Thanks.24Views0likes1CommentAdvice to partial rename uri path
Hi there masters! I would like to ask for advice. Is there a possibility that after I redirect an URL I can partial rename the 1st two paths in the redirected URI path? So, for example: when client requested our main page... "https://companyA.com/" I will redirect this to a path of "https://companyA.com/room/desktop/r/Home".. Then, I will hide/or rename the 1st two paths and this will appear on client's browser as "https://companyA.com/bed/table/r/Home". /bed/table uri path are strings not location or directory. Would this be plausible? I really just want to change their strings. I tried to code it but only the redirect is successful except for the changing of the names of the two paths: When HTTP_REQUEST{ if {([HTTP::host] equals "companyA.com" and [HTTP::uri]equals "/")}{ HTTP::redirect "https://[HTTP::host]/room/desktop/r/Home" } } When HTTP_RESPONSE { if {[HTTP::header exists "Location"]}{ HTTP::header replace "Location" [string map {"/bed/table" "/room/desktop"} [HTTP::header "Location"]] } } Can you help me on this? Thanks! Regards, ZeigSolved142Views0likes9CommentsiRule to count how often the node is down
Hello, I want to monitor the nodes in the pool and, if a node/service goes down three times within five minutes, automatically take it offline and send an email notification. Could you help me determine how to track the number of times a node/service goes down within that five-minute window? Thank you!71Views0likes1CommentEditing iRule for Maintainance Page with image local in F5 Big-IP iFile
Dear Community, I hope this message finds you well. I am reaching out to request your assistance in editing the iRule to redirect users to a maintenance page when all nodes are down. While the iRule is currently functioning as intended, I would like to incorporate images that represent our organization and application for users. I have successfully uploaded the images to F5 using iFile however, I am uncertain about how to reference these images within the HTML code of the iRule. Attached below, you will find a screenshot of the current page and a visual representation of the desired maintenance page. The code below: =================================================================================== when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { HTTP::respond 503 content " <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Maintenance Page</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; color: rgb(27, 131, 111); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; text-align: center; } .container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } h1 { font-size: 2em; margin: 0; } p { font-size: 1.2em; } .logos { margin-bottom: 20px; } .logos img { height: 150px; margin: 0 15px; } .gear-icon { font-size: 3em; color: rgb(27, 131, 111); } @media (max-width: 600px) { h1 { font-size: 1.5em; } p { font-size: 1em; } } </style> </head> <body> <div class='container'> <div class='logos'> <img src='/iFiles/Blackboard-LOGO' alt='Blackboard Logo'> <img src='/iFiles/PSAU-LOGO' alt='PSAU Logo'> </div> <h1>We'll be back soon!</h1> <p>Our website is currently undergoing maintenance. We are working hard to improve your experience. Stay tuned!</p> <p>! الموقع حاليا تحت الصيانة, نحن نعمل بجد لتحسين تجربة المستخدم، ترقبوا</p> <div class='gear-icon'>⚙️</div> </div> </body> </html> " "Content-Type" "text/html" } else { switch [HTTP::uri] { "/iFiles/Blackboard-LOGO" { HTTP::respond 200 content [ifile get "Blackboard-LOGO"] "Content-Type" "image/png" } "/iFiles/PSAU-LOGO" { HTTP::respond 200 content [ifile get "PSAU-LOGO"] "Content-Type" "image/png" } default { # Optionally handle requests for other pages here } } } } ================================================================================= Thank you in advance for your support. Regards Omran Mohamed75Views0likes8CommentsPossible to combine multiple DataGroupLists for IP-Check?
Hello F5 Community, I am working on an irule to check on two datagroup-lists and country, but I am not sure if this is possible like I want to implement this. It should check if the IP is in the list1 or list2 or its part of FR and US and if true it should allow the traffic otherwise it should be dropped. My questions would be is it possible to check against two datagroup lists, like i did in the my irule example. Or should avoid this? when HTTP_REQUEST { set client_ip [getfield [IP::client_addr] "%" 1] set from_country [whereis $client_ip country] if { not (([class match $client_ip equals /Common/list1]) || ([class match $client_ip equals /Common/list2]) || ($from_country eq "FR") || ($from_country eq "US"))} { drop } switch -glob -- [string tolower [HTTP::path]] { default { pool /Common/pool1 } } } Thank you.Solved47Views0likes4CommentsiRule URI Matching Not Working as expected.
We have a virtual server that has these three requirements: mTLS negotiation Match start of URI Match CN of certificate Note: The the virtual server where this iRule is applied does not have a pool configured as I learned that the 'reject' command doesn't necessarily do what I thought it did. Testing has proven mTLS works and I think the CN validation does too. The problem is with URI matching. Using Postman, we've found that using a bogus URI fails indefinately until a valid URI is accessed by the same source. After that, the bogus URI works too. We just found this so haven't done extensive testing. Below is a simplified version of the iRule and this is the sequence of events: https://virtualserver/bogus - fails https://virtualserver/uri-a-yaddi-yaddi - works https://virtualserver/bogus - This works for I don't know why!!! Note: Not sure the bogus URI has to be used first but that's what the tester reported. when CLIENTSSL_CLIENTCERT { set subject_dn [X509::subject [SSL::cert 0]] if { $subject_dn != "" }{ } } when HTTP_REQUEST { if { [HTTP::uri] starts_with "/uri-a" } { if { $subject_dn contains "mauth-a" } { pool serverpool-a-443 } else { reject } } elseif { [HTTP::uri] starts_with "/uri-b" } { if { $subject_dn contains "mauth-b" } { pool serverpool-b-443 } else { reject } } } The bogus URL does get rejected by the server but it should not have made it there to begin with. I'm no expert on iRules so I thought I'd post this before searching for a solution. If you happen to know what the problem is I'd be happy to save the time. Also, I'm guessing there may be a better way to do this iRule but it was created by a consultant and thought to be working properly until today. Thanks!Solved50Views0likes4CommentsExtract SSL extension from client hello
Hi, need support to extract SSL extension field name = DATA from client hello and than insert it into the client application packet. Please let me know how to accomplish this using irule. Sample client hello packet capture: Extension: Unknown type 1000 (len=14) Type: Unknown (1000) Length: 14 DATA: 111112345899887422266Views0likes0Comments