Forum Discussion

Blue_whale's avatar
Blue_whale
Icon for Cirrocumulus rankCirrocumulus
Dec 14, 2022

Why do we redirect the host header during the time of request in policy/irule ?

Hi team , 

 I need your help in understanding the below policy configured to redirect the host header during the time of request .

1.Why do we need to replace the host header? What is the need of that ? On which scenario we use this ?

 

CONDITION :

HTTP Host host is 'ppd-rrr-api.example.com' at request time.

ACTIONS :

1. Set variable named 'host' equal to 'tcl:[HTTP::header replace Host ppd-kgf.example.com]' at request time.
2. Forward traffic to pool '/Common/p_ppd-kgf.example.com' at request time.

  • Hi Sarovani,

    the Local Traffic Policy Rule replaces the (external) Host-Header "ppd-rrr-api.example.com" with an the (internal) value of "ppd-kfg.example.com" and then forwards the request to the pool "/Common/p_ppd.kgf.example.com"

    The Local Traffic Policy is most likely deployed because your internal API system wont respond to the external name. The rule and action is performing a simple rewrite of the HTTP request to make your server happy and the application work.

    On a site note: The Action sets a variable while its performing the HOST-Header replacement. This approach is probably not "best practise" and may become replaced with the action below...

    Warning: You may double check if subsequent Local Traffic Policies or iRules making use of the "$host" variable which is set by your original Local Traffic Policy. 

    Cheers, Kai

  • Hi Sarovani,

    the Local Traffic Policy Rule replaces the (external) Host-Header "ppd-rrr-api.example.com" with an the (internal) value of "ppd-kfg.example.com" and then forwards the request to the pool "/Common/p_ppd.kgf.example.com"

    The Local Traffic Policy is most likely deployed because your internal API system wont respond to the external name. The rule and action is performing a simple rewrite of the HTTP request to make your server happy and the application work.

    On a site note: The Action sets a variable while its performing the HOST-Header replacement. This approach is probably not "best practise" and may become replaced with the action below...

    Warning: You may double check if subsequent Local Traffic Policies or iRules making use of the "$host" variable which is set by your original Local Traffic Policy. 

    Cheers, Kai