I am using a IHS to route the incoming url to my application by Rewrite Rule. But i also want url to be saved so that i can use it within my application.
So my question is whether, we can copy the incoming URL to the Message HTTPHeader before performing the rewrite rule.
For eg:
url:
http://abc.test/pqr/MPP
HTTP Body:
{
"xml": {
"name": "testName",
"item": { "invoice": "447632938" }
}
}
url:
http://xyz.test/targetApp/ss
HTTP Header:
Context:"pqr/MPP"
HTTP Body:
{
"xml": {
"name": "testName",
"item": { "invoice": "447632938" }
}
}
I tried to use the below code to set the Header, but the header came as null
SetEnvIf REQUEST_URI "(.*)/pqr/MPP" HTTP_CONTEXT=REQUEST_URI
RequestHeader set HTTP_CONTEXT %{HTTP_CONTEXT}e
The below Script worked for me.
SetEnvIf REQUEST_URI "(.*)/pgr/(.*)" HTTP_CONTEXT=$2
RequestHeader set HTTP_CONTEXT %{HTTP_CONTEXT}e
When i tried with the URL : http://abc.test/pqr/XYZ
I got an HTTP Header "HTTP_CONTEXT" with value
HTTP_CONTEXT = "XYZ"