Retain the HTTP Header in URL Redirection - in POST method

Hi,

I have an iRule for below URL redirection.

when HTTP_REQUEST {

if { ([HTTP::host] eq “abc.com”) && ([string tolower [HTTP::uri]] starts_with “/iauth”) } {

HTTP::redirect https://xyz.com[HTTP::uri]

}

}

When the POST method is used to redirect , it fails and forwards the traffic on GET - is there a way to keep the header as is?

Works fine when GET method is used.

You will need to clarify, do you mean this?

  1. HTTP POST Request → 302 HTTP Redirect from the iRule
  2. HTTP POST Request with new destination → FAIL
  3. HTTP GET Request with new destination

The GET and POST method directly to redirected URL https://xyz.com/* works perfectly ok.

And GET method to actual URL https://abc.com/\* , redirects perfectly to https://xyz.com/* with no header content being missed.

only problem is with POST method where the actual URL’s https://abc.com/\* redirection is working but the header content is being missed - not giving the expected results.

I’m trying to preserve data in a HTTP 302 redirect of a POST method

Try with HTTP::respond 307 for the POST and 302 for the GET

if { [string tolower [HTTP::method]] eq “post” } {

HTTP::respond 307 Location “https://test.example.com” }

Hints:

Was able to resolve by changing redirect to respond 307, Thanks.

Cheers