Forum Discussion
Alejandro_Reyes
Nimbostratus
Feb 04, 2014HTTP redirect conserving the payoad in the POST
Hi
I'm trying to redirect a specific conecction based in a payload information. If i found a specific ID in the payload, i want to redirect that connection to a server in the cloud. The redirect wo...
Kevin_Stewart
Employee
Feb 04, 2014The easiest thing may just be to issue a 307 redirect, which should (in most browsers) honor the initial request method:
when RULE_INIT {
set static::ext_url "http://www.somewhereincloud.mx/uri"
}
when HTTP_REQUEST {
if { [HTTP::method] eq "POST" } {
if { [HTTP::header Content-Length] ne "" and [HTTP::header value Content-Length] <= 1048576 } {
set content_length [HTTP::header value Content-Length]
} else {
set content_length 1048576
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
when HTTP_REQUEST_DATA {
See if the ID field is in the POST
if { [string tolower [HTTP::payload]] contains "id=" } {
get the ID value
if { [URI::query ?[HTTP::payload] id] equals "12345" } {
perform 307 redirect
HTTP::respond 307 Location $static::ext_url
}
}
}
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