Forum Discussion

bluestar007_339's avatar
bluestar007_339
Icon for Nimbostratus rankNimbostratus
Dec 08, 2017

Irule error

Hi,

I am getting error on the below rule

when HTTP_RESPONSE {

        if { !([ HTTP::header exists "Public-Key-Pins-Report-Only “ ])} { HTTP::header insert "Public-Key-Pins-Report-Only" "aaaaasdsdsdsdsdsdsdsadsdsdsd"; pin-sha256="sdsdsdsdsdssdsdsdsdsd="; pin-sha256="sdsdsdssadsadsadsasadsadsadsadsad"; max-age=5184000; includeSubDomains;" }

}

Please help

Thanks

7 Replies

  • Please let me know what error you are getting. You are not able to apply iRule to virtual server or after applying an iRule virtual server is not working as expected?

     

  • Please let me know what error you are getting. You are not able to apply iRule to virtual server or after applying an iRule virtual server is not working as expected?

     

  • You have to add backslash before each double quote inside strings. And one double quote is not an ASCII character : use " instead of “

     

  • You have a number of syntax errors, I assume you want the information in one header, if so, please try this iRule

    when HTTP_RESPONSE {
        if {!([HTTP::header exists "Public-Key-Pins-Report-Only"])} { 
            HTTP::header insert "Public-Key-Pins-Report-Only" "aaaaasdsdsdsdsdsdsdsadsdsdsd\"; pin-sha256=\"sdsdsdsdsdssdsdsdsdsd=\"; pin-sha256=\"sdsdsdssadsadsadsasadsadsadsadsad\"; max-age=5184000; includeSubDomains;" 
        }
    }
    
  • You can use this code :

     

    when RULE_INIT {
        set stattic::PKPRO "pin-sha256=\"aaaaasdsdsdsdsdsdsdsadsdsdsd\";"
        append stattic::PKPRO "pin-sha256=\"sdsdsdsdsdssdsdsdsdsd\";"
        append stattic::PKPRO "pin-sha256=\"sdsdsdssadsadsadsasadsadsadsadsad\";"
        append stattic::PKPRO "max-age=5184000;"
        append stattic::PKPRO "includeSubDomains;" 
    
    
    }
    when HTTP_RESPONSE {
        if {!([HTTP::header exists "Public-Key-Pins-Report-Only"])} { 
            HTTP::header insert "Public-Key-Pins-Report-Only" $stattic::PKPRO
        }
    }