For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Sanjeev_126346's avatar
Sanjeev_126346
Icon for Nimbostratus rankNimbostratus
Aug 12, 2014

Http header insert depending on host

I need to have a http::header insert depending on host i get in request. Is that possible.

 

2 Replies

  • guys to be more clear with the request.

     

    I need to add below, depending on the host i get request from . I have to 2 host pointing to same VIP.

     

    when HTTP_RESPONSE { HTTP::header insert Strict-Transport-Security "max-age=3600" }

     

  • You need to set a variable in HTTP_REQUEST to use in HTTP_RESPONSE;-

    when HTTP_REQUEST {
        set fSTS 0
        if {[string tolower [HTTP::host]] eq "blah.com.au"} {
             Set flag for use in HTTP_RESPONSE
            set fSTS 1    
        }
    }
    when HTTP_RESPONSE {
        if {$fSTS} {
            HTTP::header insert Strict-Transport-Security "max-age=3600" 
        }
    }