Forum Discussion
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 }
}
}
1 Reply
Hi Blaisure,
you can try the iRules below...
when HTTP_REQUEST { set referer [HTTP::header "Referer"] } when HTTP_REQUEST_SEND { if { $referer starts_with "http" } then { clientside{ HTTP::header replace "Referer" $referer } } }There is no need to test the existence of the
during[HTTP::header]
before accessing it. You will either get a "" (nothing) or a certain "referer_value" back. InHTTP_REQUEST
you would then still check for valid referer information before writing it back to the request.HTTP_REQUEST_SENDGood luck with your iRules solution!
BTW: Didn't test the functionality. But at least the formating should be now correct.
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com