Forum Discussion
Rewriting HOST+URI does not work
Hi,
I'm using the following iRule to let the BigIP redirect a request for /webfront to website-webfront.domain.com. The redirecting should go via the BigIP, not via the client.
Source: http://pastie.org/private/lx2ds7ibjodwjgs7ayy95g
However, it never goes as planned. I either get a redirect loop, 404 or redirect to /webfront/webfront or something like that.
Edit: We're running version 11.5.1. The content we're loading is inside an iframe.
Any suggestions? Thank you.
14 Replies
- NielsH_187296
Nimbostratus
Running BigIP version 11.5.1. - Torti_93733
Nimbostratus
your irule is confusing. Do you want webfront-web.domain.com or web-webfront.domain.com?
try this:
if { ([HTTP::uri] starts_with "/webfront") } { change host name option 1 HTTP::host "webfront-[HTTP::host]" or option 2 HTTP::host "[substr [HTTP::host] 1 ".domain.com"]-webfront.domain.com" trim uri HTTP::uri [string map {"/webfront" ""} [HTTP::uri]] }- NielsH_187296
Nimbostratus
I would like subdomain-webfront.domain.com - Torti_93733
Nimbostratus
then option 2 should work - NielsH_187296
Nimbostratus
Hmm, for some reason the internal application logs me out when applying this rule.
- Torti
Cirrus
your irule is confusing. Do you want webfront-web.domain.com or web-webfront.domain.com?
try this:
if { ([HTTP::uri] starts_with "/webfront") } { change host name option 1 HTTP::host "webfront-[HTTP::host]" or option 2 HTTP::host "[substr [HTTP::host] 1 ".domain.com"]-webfront.domain.com" trim uri HTTP::uri [string map {"/webfront" ""} [HTTP::uri]] }- NielsH_187296
Nimbostratus
I would like subdomain-webfront.domain.com - Torti
Cirrus
then option 2 should work - NielsH_187296
Nimbostratus
Hmm, for some reason the internal application logs me out when applying this rule.
- StephanManthey
Nacreous
Hi, I just tested this one:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/webfront" } { set subd [getfield [HTTP::host] ".domain.com" 1] log local0. "subd: <$subd>" if { $subd contains "-dmz" } { set subd [string map {"-dmz" ""} $subd] } HTTP::header replace Host "${subd}-webfront.domain.com" HTTP::uri [string map {"/webfront" ""} [HTTP::uri]] } }Thanks, Stephan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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