Forum Discussion
Thomasvr
Jun 24, 2019Nimbostratus
Irule modify host, uri on response
Hello, The scenario is that we have url that needs to be translated to another url. So this needs to be done at the request. And for the response the url needs to be translated back to its origin...
Jun 27, 2019
Hello Thomasvr
Actually this doesn't make sense.
"Host" is a header which only applies to requests.
#--- REQUEST ---#
GET / HTTP/1.1
User-Agent: curl/7.26.0
Host: google.com
Accept: */*
The most similar header in the response is "Location" which indicates the URL for redirection.
#--- RESPONSE ---#
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Thu, 27 Jun 2019 00:40:48 GMT
Expires: Sat, 27 Jul 2019 00:40:48 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
You can replace it using next iRule
when HTTP_RESPONSE {
if { [HTTP::is_redirect] }{
HTTP::header replace Location "https://www.google.uk"
}
}
KR,
Dario.
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