Forum Discussion
xiangyang_zhang
Nimbostratus
Mar 13, 2006Add "http://" in HTTP response
Hello, all
In some HTTP requests, protocol identifier 'http://' is not added. We would like to add "http://" in URL if it doesn't exist. I wrote two iRules for this purpose, neither of them can work. Help is needed !
Rule 1:
when HTTP_REQUEST {
if { not ([HTTP::uri] starts_with "http") }{
set newUri [concat ["http://"] [HTTP:uri]]
HTTP::uri newUri
}
}
Rule 2:
when HTTP_REQUEST {
if { not ([HTTP::uri] starts_with "http") }{
set newUri [concat ["http://"] [HTTP:uri]]
HTTP::header replace uri newUri
}
}
- The protocol is not part of the HTTP spec and is definitely not part of the URI.
- xiangyang_zhang
Nimbostratus
Joe, thanks for your thoroughly instruction. - Ok, then your first rule should work, with a few modifications
when HTTP_REQUEST { if { not ([HTTP::uri] starts_with "http") } { HTTP::uri "http://[HTTP::uri]" } }
- xiangyang_zhang
Nimbostratus
Many thanks, Joe. - xiangyang_zhang
Nimbostratus
It works perfectly. Thanks for help. - Option 1 should work fine. Are you terminating the HTTPS traffic on the BIG-IP? If not, then there is no way to dig into the payload to determine the URI.
- xiangyang_zhang
Nimbostratus
Thanks again !!! - My pleasure. Keep in touch...
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