Forum Discussion
Krishna_251070
Nimbostratus
Oct 13, 2017iRule Question
Hi Experts,
I have an iRule that looks like this which is applied to a Virtual Server that listens on port 8080.
when HTTP_REQUEST {
HTTP::redirect http://[getfield [HTTP::host] ":" 1][HTTP::...
JRahm
Admin
Oct 13, 2017This works perfectly on my test system. Adding a log line as Kevin suggests:
log local0. "Rewriting [HTTP::host] to [getfield [HTTP::host] ":" 1]"
Result:
Oct 13 16:16:42 ltm3 info tmm[48128]: Rule /Common/redirectest : Rewriting 192.168.102.62:8080 to 192.168.102.62
From the tcp stream in my wireshark capture, you can see the Host with the 8080 port, the rewritten Location header without, and the subsequent request to port 80:
GET / HTTP/1.1
Host: 192.168.102.62:8080
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
HTTP/1.0 302 Found
Location: http://192.168.102.62/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
GET / HTTP/1.1
Host: 192.168.102.62
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
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