How to rewrite the parameters in request body when using Apache
When using Apache, we may make it work as a reverse proxy, change some value of the par开发者_如何学Cameters, and redirects the request.
Suppose there's a GET method reaches, such as below:
curl -i -k -X GET "https://domain.com/getall.xml?aa=111&bb=222"
In order to change the value of aa or bb, we could use mod_rewrite to operates on %{QUERY_STRING}.
But if we put the parameters aa and bb in the request body, or using a POST method to submit some of our requests, such as below:
curl -i -k -X GET -d "aa=111&bb=222" https://domain.com/getall.xml
How could we change the value of aa or bb?
As long as if the data is passed as GET
or appended in the URL, Apache mod_rewrite
should be able to change the value.
If the data is passed as POST
, then Apache
cannot use mod_rewrite
to process & change the value, you will have to manipulate it inside your code.
精彩评论