Forum Discussion
iRule or Re-write Profile
I'm trying to work out how to do the following.
I have an irule that is directing source traffic (based on IP) to a specific pool
I have a rewrite policy > changing https://example.com to https://example.com/text
this is all working
The problem I have, is I'd like https://example.com to stay the same in the client's browser
But after the client connects to the backend servers, they return a uri https://host1.com
I'd like that to appear as https://example.com
I looked at my rewrite policy and was thinking I could do a response
This doesn't appear to work.
Should I be using a single iRule to
Replace the name (inbound)
Direct to a pool
Replace the name (outbound)
2 Replies
- Sravs
Altocumulus
Yes, you can try following rule.
when HTTP_REQUEST {
if { [IP::client_addr] eq "x.x.x.x" } {
pool pool_A
}
HTTP::header replace "Host" "host1.com"
}when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
set location [HTTP::header "Location"]
set updated_location [string map {"host1.com" "example.com"} $location]
HTTP::header replace "Location" $updated_location
}# Optional: content replacement if backend returns HTML with embedded URLs
if { [HTTP::header "Content-Type"] contains "text/html" } {
STREAM::enable
}
}when STREAM_MATCHED {
STREAM::replace "host1.com" "example.com"
}when HTTP_RESPONSE_DATA {
# Needed for stream profile
}please try above irule.
- Injeyan_Kostas
Nacreous
Hi sjy2025
you have open a similar topic
iRule, Traffic Policy or Re-Write Policy | DevCentral
check my answer there.
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