Redirection type 301 sur un F5 |
Article original Publié le : 9 avril 2021 Mise a jour le : – |
Le redirect peut etre fait en policies ou en irules, quelques exemples selon les cas
I. Irules
Uri est égale a
1 2 3 4 5 6 7 |
Local Traffic ›› iRules : iRule List ›› redirect_irules when HTTP_REQUEST { if { ([string tolower [HTTP::host]] eq "<strong>url</strong>") and ([string tolower [HTTP::uri]] eq "<strong>/uri/</strong>") } { HTTP::respond 301 Location "<strong>https://redirection</strong>" } } |
Uri commençant par
1 2 3 4 5 6 7 |
Local Traffic ›› iRules : iRule List ›› redirect_irules when HTTP_REQUEST { if { ([string tolower [HTTP::host]] eq "<strong>url</strong>") and ([string tolower [HTTP::uri]] starts_with "<strong>/uri/</strong>") } { HTTP::respond 301 Location "<strong>https://redirection</strong>" } } |
Pour une uri spécifique (starts_with, eq, contains ..)
1 2 3 4 5 6 7 |
when HTTP_REQUEST { if { ([HTTP::uri] starts_with "/<strong>uri</strong>/") }{ HTTP::respond 301 Location "<strong>https://redirection</strong>" event disable } } |
II. Policies
Rediriger une uri
- Match all of the following conditions:
1 |
HTTP Host - full string - contains - any of - <strong>url</strong> - request |
1 |
HTTP Uri - full string - starts with - any of - <strong>/uri</strong> - request |
- Do the following when the traffic is matched
1 |
Redirect to location <strong>https://redirection</strong> at request |
Rediriger une Url
III. Source
K79495149: Redirecting to another URL with a 301 response