Forum Discussion

snormoyle's avatar
snormoyle
Icon for Nimbostratus rankNimbostratus
Nov 27, 2020

data groups

my company engineering group created a solution using F5 as a S3 Proxy in AWS. The iRule supplied replaces the header with the s3 FQDN. I would like to use data group so when changes are required it can be done through the data groups and not the iRule itself. I don't understand enough about data groups to know if this is possible. this f5 will be hosting many different S3/proxy virtual servers which is another reason i would use thegeneric iRule for each new virtual server and reference the data group

 

Current iRule:

when HTTP_REQUEST { if { [HTTP::header host] eq "s3customer.domain.com" } { HTTP::header replace Host "s3customerdomain.s3.amazonaws.com" } }

 

Thinking about how to do the following.

when HTTP_REQUEST { if { [HTTP::header host] eq <original header> } { HTTP::header replace Host <replacement header> } }

2 Replies

  • Thinking about how to do the following.

    when HTTP_REQUEST { if { [HTTP::header host] eq [data group]<original header> } { HTTP::header replace Host [data group]<replacement header> } }

     

    if can do within the same data group would be great.

  • Hi  

    Its very easy to achieve what you have asked ( or atleast what I understood .... 😅 )

    I have assumed the following for the data group

    name : hostmapping_dg

    contents :

    s3customer.domain.com := s3customerdomain.s3.amazonaws.com

    Please create a data group prior to using this iRule

    Here is the iRule that can do this.

    when HTTP_REQUEST { 
     
    set new_host [class search -value hostmapping_dg equals [HTTP::header host]]
     
    if { ${new_host} != "" } { 
        HTTP::redirect $new_host 
        return
      }
    }	

    Thanks,

    Muhammad