Forum Discussion
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?
- HTTP POST Request -> 302 HTTP Redirect from the iRule
- HTTP POST Request with new destination -> FAIL
- HTTP GET Request with new destination
- JamesB12Altocumulus
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.
- JamesB12Altocumulus
I'm trying to preserve data in a HTTP 302 redirect of a POST method
- msenturkAltocumulus
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
- JamesB12Altocumulus
Was able to resolve by changing redirect to respond 307, Thanks.
Cheers
Recent Discussions
Related Content
* 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