Forum Discussion
2funky_105078
Oct 08, 2013Cirrus
How to preserve data in a HTTP 302 redirect of a POST
Hi,
We are trying to implement the following scenario and would like to know if the LTM can do the following:
An application execute an HTTP POST request with parameters inside the HTML bo...
Juerg_Wiesmann
Oct 12, 2013Nimbostratus
when RULE_INIT {
set static::ext_url "http://host.header.com/path/login.php"
}
when HTTP_REQUEST {
Check if request was a POST
if { [string tolower [HTTP::method]] eq "post" } {
Check if there is a Content-Length header
if { [HTTP::header exists "Content-Length"] } {
if { [HTTP::header "Content-Length"] > 1048000 }{
Content-Length over 1Mb so collect 1Mb
set content_length 1048000
} else {
Content-Length under 1Mb so collect actual length
set content_length [HTTP::header "Content-Length"]
}
} else {
Response did not have Content-Length header, so use default of 1Mb
set content_length 1048000
}
Don't collect content if Content-Length header value was 0
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
when HTTP_REQUEST_DATA {
set content "?"
foreach p [split [HTTP::payload] &] {
set name [URI::decode [getfield $p = 1]]
set value [URI::decode [getfield $p = 2]]
set content "${content}$name=$value&"
log local0. "Content: $content"
}
set content "${content}"
set where_to "$static::ext_url$content"
log local0. "$where_to"
}
when HTTP_RESPONSE {
if { [info exists where_to] } {
HTTP::respond 302 Location $where_to
}
}
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