Forum Discussion

Donyemachi's avatar
Donyemachi
Icon for Nimbostratus rankNimbostratus
Aug 05, 2019

uri rewriting

I have a requirement to perform uri rewriting based on specific conditions. I have tried using "http:redirect" method but this converts the HTTP method from "POST" to "GET" when the client tries to resend the request.

 

when HTTP_REQUEST {

 

if { ( [HTTP::uri] == "/abcd/1/0/notify") } {

HTTP::uri /xyz/1/0/rest/notify/

pool POOL1

}

}

 

when I try this code, the uri doesn't change as the request is forwarded to the pool. Please what are m doing wrongly.

 

 

 

2 Replies

  • Can you try this?

    when HTTP_REQUEST {
    	if  { [HTTP::uri] equals "/abcd/1/0/notify" } {
    		HTTP::uri "/xyz/1/0/rest/notify"
    		pool POOL1
    	}
    }

    If you don't want to change method, you use "307 redirect".

    HTTP::respond 307 Location "https://test.example.com"
    • Donyemachi's avatar
      Donyemachi
      Icon for Nimbostratus rankNimbostratus

      Thanks Mate. The first option worked perfectly. I was able to rewrite the URIs. I appreciate !!!