rewrite uri
8 TopicsUri Rewrite and relative Uri's/Links
Hello Folks, I think it's more an theoretical question, but with a practical background. I've the following secenario. Client side is requesting "https://www.domain.com/app Proxy performs a HTTP:uri rewrite from /app to "/" (content on backend system is in the root directory). That's working fine -> I'll get a Login mask and then I'll get some incomplete content back in the browser. After looking the site source code I'll find a lot of "relative links" <!DOCTYPE html> <html lang="en"><head><meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <base href="/" /> <link href="css/rich-text/bundle.min.css" rel="stylesheet"> <link href="css/rich-text/css/dx.light.css" rel="stylesheet"> <link href="css/rich-text/bundle-richedit.min.css" rel="stylesheet"> <script src="_framework/blazor.webassembly.js"></script> <script src="_content/MudBlazor/MudBlazor.min.js"></script> <script src="_content/Dsm.Blazor.Components/common.bundle.js"></script> <script src="_content/Dsm.Blazor.Components/contextmenu.bundle.js"></script> and so on. The problem is, the browser is requesting all these links without the subdirectory /app https://www.domain.com/css/rich-text instead of https://www.domain.com/app/css/rich-text A search on the WWW says that the usage of subfolders + rewrites with relative paths should not really be a problem. Or rather, this was described as a workaround. According to my understanding of relative links, these should simply be added to the existing browser URL during the request. Do I have a problem understanding relative links here or could be the <base href="/" /> the problem (because all paths are relative to / [root path] thus removing the /app path from subsequent requests)? Thanks in advance for you help. rschwarz32Views0likes2CommentsRewrite and Redirect iRule v11 using Datagroup
We want to replace a specific string to a specific string but keep the whole remaining URI portion. For example, if original URI is https://qa.company.com/wps/portal/company/personal/banking/checking/index.html, We want to change it to https://qa.company.com/personal/banking/checking/index.html with respond with a 301. We also would like to use a datagroup for additional URI matching. Is there a way to accomplish this using the ProxyPass iRule? I thought about using something like the following, would this be the best approach? How do I append the rest of the URI? set httpuri [string tolower [HTTP::uri]] Rewrite/Redirect If "/wps/portal/company/personal" is found, “/wps/portal/company” will be removed and the URI becomes simply “/personal” if {$httpuri starts_with "/wps/portal/company/personal"} { set httpuri [string replace [HTTP::uri] 0 14] HTTP::respond 301 https://[HTTP::header "host"]$httpuri return }336Views0likes1CommentBIG-IP add custom header
F5 BIG-IP LTM VE v11.4.0 on ESXi I want to add a custom header to my request before rewriting to a backend server : when HTTP_REQUEST { HTTP::header insert uri-original [HTTP::uri] ... HTTP::uri $rewrite_uri pool backend-pool-01 } However my tests do not show this header present. Am I adding the header correctly ? What are the rules around retaining added headers ? How can I log all headers present in my request ? UPDATE ( 2014-11-29 ) : For case where iRule is assigned to a virtual-server with an http profile, I verified above TCL does add header as expected. However, for https case, adding the header writes errors to the f5 logs : Nov 14 22:03:03 f5-01 err bigd[6134]: 01060111:3: Open SSL error - error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure. Nov 14 22:03:04 f5-01 err tmm1[8371]: 01220001:3: TCL error: /Common/xheader-irule-01 - Operation not supported (line 1) invoked from within "HTTP::header insert original-uri [HTTP::uri]"1.2KViews0likes16Commentsirule to rewrite header but respond with 200
Hi All, Im trying to setup an irule (and struggling :-)) that will perform the following. Upon accessing a site, the request will be rewritten to essentially send the client elsewhere, however rather than providing a 301/302 redirect I need a 200 response to be sent to the client for the initial request. For example once this rule is setup, a request for a page www.test.com/p/content/ will result in a 200 response for the user. This will work using the URL handling rule sending requests ahead without generating a response to the user and the 200 response coming from www.test.com. the irule below seems to direct the user correctly but I cant seem to force the 200 response When HTTP_REQUEST { if { [HTTP::host] contains "www.test." and [HTTP::uri] starts_with "/p/" } { HTTP::header replace Host "www.test.com" } }908Views0likes7Commentsrewrite uri with datagroup
Hi I'm new to irules and have got where I am but looking at other irules we have, but am still struggling. I have a request from marketing to host a number (40) of small websites. Rather than setting up a new vip/pool/node/website for each one I would like to inspect the hostheader, forward it to a pool, rewrite the uri and be invisible to the user. This way I can simply copy the content to a single website. e.g. nick.domain.co.uk/* -> forward to pool POC_Boxes -> uri rewritten to /nick/* alan.domain.co.uk/* -> forward to pool POC_Boxes -> uri rewritten to /alan/* lara.domain.co.uk/* -> forward to pool POC_Boxes -> uri rewritten to /lara/* I have been able to get this working using a switch irule but would prefer a datagroup as it is easier to maintain going forward. However, I am having trouble reading data from the datagroup here is my switch irule when HTTP_REQUEST { set marketingURI "[HTTP::uri]" switch -glob -- [string tolower [URI::decode [HTTP::host]]] \ "nick.domain.co.uk" { HTTP::uri "/nick$marketingURI" pool POC_boxes } switch -glob -- [string tolower [URI::decode [HTTP::host]]] \ "lara.domain.co.uk" { HTTP::uri "/lara$marketingURI" pool POC_boxes } switch -glob -- [string tolower [URI::decode [HTTP::host]]] \ "alan.domain.co.uk" { HTTP::uri "/alan$marketingURI" pool POC_boxes } else { HTTP::redirect "http://www.domain.com" } } Here is my datagroup irule when HTTP_REQUEST { if { [class match [string tolower [HTTP::host]] starts_with POC_DGL_Marketing_trades] } { set url_URI [class match -value [string tolower [HTTP::host]] starts_with POC_DGL_Marketing_trades] set marketingURI "$url_uri[HTTP::uri]" HTTP::uri "$marketingURI" pool POC_boxes } else { HTTP::redirect "http://www.domain.com" } log local0. "Marketing Trades [HTTP::host]" } Here is my datagroup Name Value nick.domain.co.uk /nick alan.domain.co.uk /alan lara.domain.co.uk /lara Thanks Nick647Views0likes7CommentsBest method to rewrite Request and Response URI, preserve URI data, and with no client redirect
Looking for the best method (iRule, HTTP Class, etc) to rewrite URI while preserving the trailing data in the URI and ensuring that no client redirect occurs. I also need to insert a header in the mix of all this. Client request - https://www.site.com/123 F5 Rewrite - Request - https://www.site.com/123 to https://www.site.com/321 Insert Header SetContextURI: http://www.site.com/123 F5 Rewrite - Response - https://www.site.com/321/blah/data (Preserve Data) to https://www.site.com/123/Blah/data I have looked at several options, but none bring both the Request, Response, and header insert together or will do a client redirect.529Views0likes6CommentsURL re-write profile not working
I am trying to use the URL Re-write profile feature of the LTM, I have never used this feature before but it seems fairly straight forward to configure. I am trying to do the following: When a user hits the outsite URL, www.website.com the internal request is server1.internal.com/application I have setup a re-dwrite profile and attached it to the VIP but it doesn't seem to be taking effect. It seems to just hit the root of the internal web server in the pool. I even tried changing the internal URI (the Server URI) to a non existent value http://test.com/xyz/ and it still just loads the website home page. It almost seems like it's ignoring the profile. I am defintely configuring the correct VIP etc. My next step was to try and configure it via an Irule. I looked at an existing example on Devcentral and used the one below but it doesn't seem to like the sytax. Irule I am trying to use: I get the following error: Any help with either would be appreciated. Thanks391Views0likes5CommentsRewrite HTTPS URL
Hi, Is there anyone who can help me with the following problem? My internal server is configured to access a URL: https://sample.domain.com/soap/ There is no possibility to change the above URL in the server (that would be to easy). The supplier is changing the URL to https://sample.domain.com/soap/test/ I want to rewrite the URL in my F5 LTM through a VIP. Can anyone help me with a example iRule to do the trick? Greetings PeterSolved1.2KViews0likes8Comments