Forum Discussion
JohnL_247646
Nimbostratus
Feb 03, 2016Need help with Cisco ACE header rewrite to irule
I need some help doing this conversion from Cisco Ace to iRule. There is a header request that convert the users URL request from "hostA.companyA.com/whatever/comes/after" replace "host1.companyA.co...
Kai_Wilke
MVP
Feb 03, 2016Hi John,
an ACE action-list of...
action-list type modify
http login
header rewrite request Host header-value "hosta[.]companyA[.]com(.)" replace "host1.companyA.com:64592%1"
header rewrite response Location header-value "https://host1.companyA.com:64592/(.)" replace "https://hosta.companyA.com/%1"
... could be translated to ...
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "hosta.companya.com" } then {
HTTP::header replace Host "host1.companyA.com:64592"
}
}
when HTTP_RESPONSE {
if { [string tolower [HTTP::header value Location]] starts_with "https://host1.companya.com:64592" } then {
HTTP::header replace Location "https://hosta.companyA.com[getfield [HTTP::header value Location] ":64592" 2]"
}
}
Note: I'm using
to make it more robust. So keep an eyee on lower CASE formating for the equals and starts_with comparsions.[string tolower]
Cheers, Kai
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects