Forum Discussion
JosephT
Nimbostratus
Jun 13, 2008iRule redirect help
I have an irule that redirects all traffic to https:
rule https.redirect.irule {
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
This works fine on a VIP listening on port 80 - all traffic is redirected to https.
I tried applying this to a vip listening on port 8004, but it is not working. Is this even possible?
- The_Bhattman
Nimbostratus
It should as so long as it's http coming into a VIP on tcp port 8004.when HTTP_REQUEST { HTTP::redirect "https://[HTTP::host][HTTP::uri]" log local0. "Client [IP::client_addr] requested [HTTP::host][HTTP::uri] } }
- hoolio
Cirrostratus
When testing with the VIP on port 8004, does the client make requests with the port number in the Host header? If so, you could remove it using the Codeshare example:when HTTP_REQUEST { Check if Host header value has a length if {[string length [HTTP::host]]}{ Redirect to the requested host and URI (minus the port if specified) HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] } else { Redirect to VIP's IP address HTTP::redirect https://[IP::local_addr][HTTP::uri] } }
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