Forum Discussion
John_Comstock
Nimbostratus
Sep 13, 2006iRule for URL Re-write
I have a requirement to rewrite the URL that external business partners connect to for both HTTP and HTTPS (will terminate SSL on the BigIP) traffic to forward to internal web sites. Can anyone direct me to posts that will get me started?
External business partners will hit https://theirsite.externaldomain.com
and I will need to forward them to another proxy server (for logging purposes)and forward them to the internal site http://oursite.internaldomain.com
while keeping the pertinent URI string.
Assistance would be much appreciated.
John
9 Replies
Sort By
- Colin_Walker_12Historic F5 AccountI'm not sure I caught the part about needing to forward them to a proxy server. Are you saying you need to forward the traffic two places? Or are you just wanting to redirect a request from https://theirsite.externaldomain.com to http://oursite.internaldomain.com?
when HTTP_REQUEST { if { [HTTP::host] eq "theirsite.externaldomain.com" } { HTTP::redirect http://oursite.internaldomain.com } }
- John_Comstock
Nimbostratus
Hi, - Deb_Allen_18Historic F5 AccountHi John -
when HTTP_REQUEST { if { ( [getfield [HTTP::host] ":" 1] ends_with "external.net" ) } { HTTP::header replace Host [string map -nocase {"external.net" "internal.net"} [HTTP::host]] } }
- Deb_Allen_18Historic F5 Account(edited to correct replacement string in map command...)
- Colin_Walker_12Historic F5 AccountGreat example Deb.
- G__Wesley_RoberHistoric F5 AccountHi,
Given the following data group, if found replace one with two class urlrewrite { "apples.com oranges.com" "foo.com bar.com" "peas.com carrots.com" } when HTTP_REQUEST { set entry [findclass [HTTP::host] $::urlrewrite " "] if {$entry != ""} { log "Entry not null, replacing Host: [HTTP::host] with: $entry" HTTP::header replace Host $entry } }
- John_Comstock
Nimbostratus
Hi, - John_Comstock
Nimbostratus
We modified our iRule to prepend the protocol and fqdn.when HTTP_REQUEST { set entry [findclass [HTTP::host] $::urlrewrite " "] if {$entry != ""} { log "Entry not null, replacing Host: [HTTP::host] with: $entry" HTTP::header replace Host $entry if {[HTTP::uri] starts_with "/"} { HTTP::uri http://$entry[HTTP::uri] } } }
- John_Comstock
Nimbostratus
Our application was sending a 301 redirect back to the client with our internal url…when HTTP_REQUEST { set myhost [HTTP::host] set entry [findclass [HTTP::host] $::urlrewrite " "] if {$entry != ""} { log "Entry not null, replacing Host: [HTTP::host] with: $entry" HTTP::header replace Host $entry if {[HTTP::uri] starts_with "/"} { HTTP::uri http://$entry[HTTP::uri] } } } when HTTP_RESPONSE { if {[HTTP::status] contains "301"} { if {$myhost != ""} { set myuri [findstr [HTTP::header Location] ".com/" 5] HTTP::header replace Location https://$myhost/$myuri } } }
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