Forum Discussion
DChu_344155
Nimbostratus
Dec 15, 2017HTTP Redirect not working
I am new to iRules and I am trying to setup an iRule to redirect some traffic. I want to do this when status 301 and 302 are returned in the headers, but for basic testing I went with just the below ...
Stanislas_Piro2
Cumulonimbus
Dec 16, 2017when you request URL http://www.domain123.com/.well-known/acme-challenge/aeIswOdWkV3TlYv24PI7Nv9OYvcF0eKfyrLlVpdSW7s, the HTTP request is:
GET /.well-known/acme-challenge/aeIswOdWkV3TlYv24PI7Nv9OYvcF0eKfyrLlVpdSW7s HTTP/1.1
Host: www.domain123.com
User-Agent: Mozilla/4.0......
So following HTTP commands return:
- HTTP::host -->
- HTTP::uri --> /.well-known/acme-challenge/aeIswOdWkV3TlYv24PI7Nv9OYvcF0eKfyrLlVpdSW7s
So the irule must be:
when HTTP_REQUEST {
if {([HTTP::host] equals "www.domain123.com") } {
HTTP::redirect "http://www.somethingelse.com[HTTP::uri]"
}
}
or if you want to manage URI in condition:
when HTTP_REQUEST {
if {([HTTP::host] equals "www.domain123.com") && [HTTP::uri] starts_with "/.well-known/acme-challenge/"} {
HTTP::redirect "http://www.somethingelse.com[HTTP::uri]"
}
}
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