Forum Discussion
Leslie_South_55
Nov 06, 2008Nimbostratus
HTTP::respond + append URI from HTTP::request
I am using the sample for HTTP::respond 301 from http://devcentral.f5.com/Wiki/default.aspx/iRules/findclass.html
I need to be able to grab anything after the host and append this to th...
Leslie_South_55
Nov 07, 2008Nimbostratus
The 301 vs. a 302 is the request of the client, and to my understanding, HTTP::respond is the only way to issue a 301. Using the example I can append anything to the URI, but I get a double slash in the request
Here is the rule I am using (complements of the devcentral examples)
when HTTP_REQUEST {
Check if there is a class entry which starts with the requested URI
set row [findclass [string tolower [HTTP::host]] $::host_redirects]
Check if there was a matched row
if { $row ne "" }{
log local0. "Matched $row"
Send a response using the status and location from the class
HTTP::respond [getfield $row " " 2] Location [getfield $row " " 3][HTTP::uri] Connection Close
Clear the row variable
unset row
}
}
The request was to http://host1.domain.com/foo
the 301 sends the request to
https://securehost.domain.com//foo
Is there a way to remove the double slash from this line, as it is sending the entire URI
HTTP::respond [getfield $row " " 2] Location [getfield $row " " 3][HTTP::uri] Connection Close
Thanks
-L
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