rewrite
32 TopicsiRule 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. NikosSolved60Views0likes6CommentsRewrite 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.688Views0likes3CommentsHow 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, Mike19KViews0likes15CommentsRewrite 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.2KViews0likes5CommentsRedirect 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.Solved549Views0likes3CommentsConditionally 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.247Views0likes1CommentiRule 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 regardsSolved644Views0likes2CommentsRewrite 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!239Views0likes1CommentSwitch option always matches on default
Hello everybody. I have one question which probably for some people should be something simple, but I have spent a few days on a lab environment and studying a lot, with no succesfull results. I need to do a previous check to send a path which starts with /pf to a pool, but always goes to the default pool. The first or second part is working, but I can't make it work together. This is the iRule: when HTTP_REQUEST { if {[string tolower [HTTP::uri]] starts_with "/pf" } { HTTP::uri [string map {"/pf/" "/PF/"} [HTTP::uri]] pool Pool_apache_lab } switch -glob [string tolower [HTTP::path]] { "default" { HTTP::respond 200 content { Default switch } } } } Mandatory is not to touch "switch -global", but for the first match, I can use a "global", "if", "else if" or anything you suggest. Thanks in advance.316Views0likes2CommentsURI Rewrite not rewriting form action
We have a rewrite profile (of type URI Translation) that doesn't seem to be rewriting what we want it to. I looked at the HTML that it should be rewriting, it seems to be called via a form action: Could the hex encoding of the URI be causing it not to fire? It's looking for https://server1.contoso.com:8203/sap/ but it might only be seeing it with hex encoding of the special characters https&x3a;&x2f;&x2f;server1.contoso.com&x3a;8203&x2f;sap&x2f; Rewrite rules should work with form actions, correct? I think I have the basics right, response settings has rewrite headers and rewrite content both checked, in the virtual server under Content Rewrite the rewrite profile is set, and the HTML profile is set to HTML - I don't know what else it could be. We're on the following build: BIG-IP 11.6.0 Build 0.0.401 Final Thanks!324Views0likes1Comment