rewrite
34 TopicsiRule, Traffic Policy or Re-Write Policy
Hi, I have created an iRule that maps source addresses to a particular pool when CLIENT_ACCEPTED { if {[class match [IP::client_addr] equals clients1] } { pool POOL_1 } elseif {[class match [IP::client_addr] equals clients2] } { pool POOL_2 } elseif {[class match [IP::client_addr] equals clients3] } { pool POOL_3 } elseif {[class match [IP::client_addr] equals clients4] } { pool POOL_4 } elseif {[class match [IP::client_addr] equals clients5] } { pool POOL_5 } else { pool POOL_6 } } I have a re-write policy that changes the uri https://example.com to https://examples.com/test When the connection completes to the backend servers, they respond with their hostname in the browser. I want to keep https://example.com on the client side but I'm not sure how to achieve this. I thought I could do a response within my re-write policy but this fails. I then looked at traffic policies but already have an ASM policy attached Should I try and achieve everything under one irule (if so how, might I do this) It replaces the original uri with a new uri (going to the server) Have my current source to pool mapping Replace the server hostname with the original uri https://example.com Thanks for any pointersSolved210Views0likes11CommentsiRule or Re-write Profile
I'm trying to work out how to do the following. I have an irule that is directing source traffic (based on IP) to a specific pool I have a rewrite policy > changing https://example.com to https://example.com/text this is all working The problem I have, is I'd like https://example.com to stay the same in the client's browser But after the client connects to the backend servers, they return a uri https://host1.com I'd like that to appear as https://example.com I looked at my rewrite policy and was thinking I could do a response This doesn't appear to work. Should I be using a single iRule to Replace the name (inbound) Direct to a pool Replace the name (outbound)95Views0likes2CommentsiRule URI rewrites don't always use the correct pool
Hello F5 community! I have created an iRule for specific URI rewrites, but it seems that the requests are not getting directed always to the proper pool. Example: We want www.example.com/api/views to use the 9231 pool. However some requests are ending up to different pools as well, even though the rewrite is correct. I have attached the traffic logs and the irule configuration as well. I'd appreciate your feedback! Thank you in advance. NikosSolved195Views0likes6CommentsRewrite profile statistics in ltm
Hi, I have some rewrite profiles attatched to LTM virtual servers. I don´t know if they are being used and I would like to delete them if they are not being used. Is there a way to let me know if these profiles are being matched? Thank you very much.836Views0likes3CommentsHow to rewrite a path to a backend service dropping the prefix and passing the remaining path?
Hello, I am not sure whether my posting is appropriate in this area, so please delete it if there is a violation of posting rules... This must be a common task, but I cannot figure out how to do the following fanout rewrite in our nginx ingress: http://abcccc.com/httpbin/anything -> /anything (the httpbin backend service) When I create the following ingress with a path of '/' and send the query, I receive a proper response. curl -I -k http://abczzz.com/anything apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: mikie-ingress namespace: mikie spec: ingressClassName: nginx rules: - host: abczzz.com http: paths: - path: / pathType: Prefix backend: service: name: httpbin-service port: number: 8999 What I really need is to be able to redirect to different services off of this single host, so I changed the ingress to the following, but the query always fails with a 404. Basically, I want the /httpbin to disappear and pass the path onto the backend service, httpbin. curl -I -k http://abczzz.com/httpbin/anything apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: mikie-ingress namespace: mikie annotations: nginx.ingress.kubernetes.io/rewrite-target: /$2 spec: ingressClassName: nginx rules: - host: abczzz.com http: paths: - path: /httpbin(/|$)(.*) pathType: Prefix backend: service: name: httpbin-service port: number: 8999 Thank you for your time and interest, Mike21KViews0likes15CommentsRewrite http:// to https:// in response content
Problem this snippet solves: (Maybe I missed it, but) I didn't see a code share for using a STREAM profile to rewrite content from http to https. This share is just to make it easier to find a simple iRule to replace http:// links in page content to https://. It's taken directly from the STREAM::expression Wiki page. How to use this snippet: You'll need to assign a STREAM profile to you virtual server in order for this to work (just create an empty stream profile and assign it). Code : # Example which replaces http:// with https:// in response content # Prevents server compression in responses when HTTP_REQUEST { # Disable the stream filter for all requests STREAM::disable # LTM does not uncompress response content, so if the server has compression enabled # and it cannot be disabled on the server, we can prevent the server from # sending a compressed response by removing the compression offerings from the client HTTP::header remove "Accept-Encoding" } when HTTP_RESPONSE { # Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ # Replace http:// with https:// STREAM::expression {@http://@https://@} # Enable the stream filter for this response only STREAM::enable } } Tested this on version: 11.53.6KViews0likes5CommentsRedirect Rewrite not working - how write an irule to redirect non-standard port
Simple port change, just not sure which path to take. I have a virtual server that is listening on 443. It redirects to a server on the backside that is listening on http (not SSL) via port 10108. When users are clicking around this server there are links that are taking them to http://URL.EXAMPLE.COM:10108. In the past I've always applied an HTTP profile and just did rewrite redirect to "all". But for some reasons it's not catching this one. So I'm trying to write an irule that says ...when an http request comes in for 10108 go ahead and take the 10108 off and redirect it to https. I think that for this to work I would have to first create virtual server to listen on 10108...which I don't really want to do. So my question(s) are as follows: why isn't redirect rewrite working? Isn't that the entire point of that command if I want to just redirect these inbound requests do I need to have a server listening on 10108 (pretty sure that is a yes...otherwise my understanding of traffic flow is completely off) What irule command do I use to replace just the port? I believe that the HTTP::header contains the port. I don't think that the port is contained in the URI or in the PATH, so do I need to replace the header with the stripped off port number? To maintain the rest of the URI do I need to first save that as a variable and then add it back in? when HTTP_REQUEST { if {[HTTP::header] contains "10108" HTTP::header replace Host "URL.EXAMPLE.COM" HTTP::redirect https://[HTTP::host]/HTTP::uri } ...that certainly doesn't look right, so any help would be appreciated.Solved614Views0likes3CommentsConditionally inject text into HTML responses
Hello, An LTM needs to inspect a server's response pages and rewrite the HTML so that, for every URL written without a specific URI path, the URI path is inserted. Example: Server sends back calls to URL http://server.example /path /image.jpeg -- Ok, no action Server sends back calls to URL http://server.example/image.jpeg -- Need to inject /path I haven't been able to get a working syntax, any help will be immensely appreciated.261Views0likes1CommentiRule with regex, change string inside URI for another one
Hello, I want to redirect ( http 301) this request domain.com/pl/_company-id/SOME_DIGITS New request should look like this: domain.com/_company-id/SOME_DIGITS/?language_code REGEX domain.com/pl/_company-id/(\d+) domain.com/_company-id/$1/?language_code So I need to match SOME_DIGITS string and put it after new URI + put another sting later Should I change SOME_DIGITS to variable and use it later ? How can I do it ? I've no idea how to achive this goal, please help if anyone knows. best regardsSolved697Views0likes2CommentsRewrite profile
Hello guys, So as proxypass will be soon removed I am creating rewrite profile as substitute. However it is not working 😞 so this is my scenario (just sample) will be redirected to Configuration Rule Type: Both Client: /home/ Server: http://www.f5.com/ My proxypass configuration for Data group was www.cathy.com/home := www.f5.com/ HTTP_F5_pool My rewrite profile is not working but my proxypass is working. I think the difference is on the pool? Can anyone check my config. Am I missing something? Thank you!264Views0likes1Comment