Forum Discussion
SANTHOSHKUMAR_S
Aug 01, 2016Nimbostratus
irule for x forwarder
We have virtual server with wildcard certificate installed , like *apps.abc.com . I need have x forwarder enabled when there is request for name1.apps.abc.com , Similarly I need to disable x forwarde...
Yann_Desmarest
Cirrus
Hi,
You can also use switch or a datagroup :
using SWITCH :
when HTTP_REQUEST {
switch [HTTP::host] {
"name1.apps.abc.com" -
"namex.apps.abc.com" {
HTTP::header remove "X-Forwarded-For"
or do nothing
}
default {
HTTP::header insert "X-Forwarded-For" [getfield [IP::client_addr] "%" 1]
}
}
}
Using DATAGROUPS
when HTTP_REQUEST {
if { [class match [HTTP::host] contains X_FORWARD_HOST] } {
HTTP::header insert "X-Forwarded-For" [getfield [IP::client_addr] "%" 1]
} else {
HTTP::header remove "X-Forwarded-For"
or do nothing
}
}
Once you know the logic of those commands, you can choose the way you want to manage your exceptions.
Yann_Desmarest
Aug 01, 2016Cirrus
Hi,
If you have only one exception so I suggest to use a single if condition with the host exception in direct within the irule code.
If you have several exceptions, you can thing implementing the switch version of the irule.
And if you have lot of exceptions, I recommend to use datagroups.
For single if condition :
when HTTP_REQUEST {
if { !([HTTP::host] eq "name1.apps.abc.com") } {
HTTP::header insert "X-Forwarded-For" [getfield [IP::client_addr] "%" 1]
}
}
Hope it helps you to make your choice.
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