ASM Referrer Support - iRule
We have ran into a problem when we enable the web scraping policy in ASM it injects a JavaScript client-side challenge that inadvertently changes the referrer header to reflect the landing page rather than the origin page. We are trying to design an iRule that would restore the referrer header prior to sending the request to the server. But could use some input on how to properly build this, below is what we think might work in this situation.
when HTTP_REQUEST { if {[HTTP::header exists "Referer"] set referer [HTTP::header "Referer"] } }
when HTTP_REQUEST_SEND { if {$referer starts_with "http" }{ clientside{ HTTP::header replace "Referer" $referer }
}
}