Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Retain the HTTP Header in URL Redirection - in POST method

JamesB12
Altocumulus
Altocumulus

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.

 

 

5 REPLIES 5

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

 

JamesB12
Altocumulus
Altocumulus

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.

JamesB12
Altocumulus
Altocumulus

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

msenturk
Altocumulus
Altocumulus

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:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302

 

 

 

 

JamesB12
Altocumulus
Altocumulus

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

 

Cheers