0

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:

Incoming Request

url: 
    http://abc.test/pqr/MPP

HTTP Body:
{
 "xml": {
   "name": "testName",
   "item": { "invoice": "447632938" }
  }
}

To be converted to

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
4

1 回答 1

0

下面的脚本对我有用。

SetEnvIf REQUEST_URI "(.*)/pgr/(.*)" HTTP_CONTEXT=$2
RequestHeader set HTTP_CONTEXT %{HTTP_CONTEXT}e

当我尝试使用 URL 时:http://abc.test/pqr/XYZ

我得到了一个带有值的 HTTP 标头“HTTP_CONTEXT”

HTTP_CONTEXT = "XYZ"
于 2017-06-22T13:19:26.267 回答