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 ...
Mar 13, 2006
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]"
}
}
The TCL concat command concatenates two lists and the resulting value will be space delimited. Also, enclosing the "http://" in brackets should result in a runtime error because you are telling the code to run the "http://" command which doesn't exist.
I've just avoided the overhead of the temporary variable and created the concatenated string directly in the HTTP::uri command statement.
If this still doesn't work, then I'd suggest throwing some log statements in to verify that the "if" condition is met and that the "HTTP::uri" command is actaully getting called. If that is happening and you still aren't seeing the correct GET request on the backend server, then you'll probably have to contact F5 Technical Support to get further assitance.
-Joe
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