Forum Discussion
DaveC_21078
Feb 07, 2011Altostratus
Change path
I have a URL where I need to alter the path, to eliminate the SSL in or w/o caring what comes afterSSL/. I thought it would fairly simple, but I can't get it to work. Thanks.
16 Replies
Sort By
- Chris_MillerAltostratusEasy enough using the string command. Just to verify though, you want to remove this between LTM and your pool members. You aren't trying to redirect the user or anything like that?
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/ssl/" } { HTTP::uri [string range [HTTP::uri] 4 end] } }
- DaveC_21078AltostratusThanks for the replies. I actually got this to work.. I'll try yours too Hoolio.
- Chris_MillerAltostratusAaron/Colin - let's say he wanted to remove the string "/ssl" that occurred anywhere within the rule, what would we use then?
- DaveC_21078AltostratusOne more question. How do I make this work if the request is https? This has stumped me in the past.
- hoolioCirrostratus
- DaveC_21078AltostratusChris, I meant your iRule. Sorry. Yours doesn't work when the request is HTTPs, while mine does, but yours is more universal. Why doesn't it work with HTTPS? I've seen this before. Thanks again.
- DaveC_21078AltostratusThe site works in https, but the rule doesn't eliminate the /SSL if the request is https.
- Colin_Walker_12Historic F5 Account@Chris
when HTTP_REQUEST { set uri [tolower [HTTP::uri]] if { $uri contains "/ssl/" } { set index [string first /ssl/ $uri] set newuri [string replace [HTTP::uri] $index [expr $index + 3]] HTTP::uri $newuri } }
- Colin_Walker_12Historic F5 AccountString map would certainly work but keep in mind it's going to nuke every entry of SSL it sees, so make sure you're using something completely unique. The reasoning for the above logic was to make sure it's only replacing the first instance of the string, not all of them.
- DaveC_21078AltostratusChris, I only have one virtual server for this site that's open to all ports, and then I use an irule to only allow ports 80 and 443. I've noticed in the past that re-write rules don't work the same for https requests as they do for http requests to the same virtual server. I've found work-arounds, but haven't identified the issue. If I could make your rule work for both, I could use it on numerous sites where we're getting ready to change the path, instead of customizing my rule for each site. I don't mind customizing, but I'd like to keep down the of rules. Dave
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects