cancel
Showing results for 
Search instead for 
Did you mean: 

URL Rewrite?

Shannon_Thompso
Nimbostratus
Nimbostratus

This is not my realm so first time trying to do iRules, I have the following redirect code that works (remove actual site names):

 

when HTTP_REQUEST { set new_path [string trim [string tolower [HTTP::path]]] set new_site "https://abc.abc.com" if { $new_path eq "/reseller" } { HTTP::redirect "$new_site$new_path" } elseif { $new_path contains "/reseller/" } { HTTP::redirect "$new_site$new_path" } }

 

but what I really need to to able for xyz.abc.com/reseller to go to abc.abc.com/reseller without the browser URL changing to abc.abc.com. Is this even possible?

1 ACCEPTED SOLUTION

Hamish
Cirrocumulus
Cirrocumulus

It's possible if abs.abc.com site is accessible from the BigIP... By simply using a pool for abc.abc.com's (Even if you have to create a new one) to service requests that hit /reseller/

 

BTW, I'd use starts_with rather than contains... Otherwise the URL /something/reseller/something will get redirected as well, which doesn't match your stated requirement https://clouddocs.f5.com/api/irules/starts_with.html

 

i.e.

  1. Create pool for abc.abc.com
  2. Replace HTTP::redirect with POOL $pool_name (https://clouddocs.f5.com/api/irules/pool.html)

 

H

View solution in original post

1 REPLY 1

Hamish
Cirrocumulus
Cirrocumulus

It's possible if abs.abc.com site is accessible from the BigIP... By simply using a pool for abc.abc.com's (Even if you have to create a new one) to service requests that hit /reseller/

 

BTW, I'd use starts_with rather than contains... Otherwise the URL /something/reseller/something will get redirected as well, which doesn't match your stated requirement https://clouddocs.f5.com/api/irules/starts_with.html

 

i.e.

  1. Create pool for abc.abc.com
  2. Replace HTTP::redirect with POOL $pool_name (https://clouddocs.f5.com/api/irules/pool.html)

 

H