You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Suneet Shah <su...@gmail.com> on 2011/09/20 23:32:12 UTC

[users@httpd] Mod-Proxy and Mod-Headers

Hello,

I had a question about Mod-Proxy and Mod_headers

1) Is it possible to take a values that are on a query string and pass them
as headers? If so how?
For example, if I have:

http://host/myap?userid=abc&role=myrole
I would like to take the values in the query string and pass them as headers
to the app that I am proying to

2) I would like to pass the above headers or query string parameters on
every request.
How can I do this? Is there a way to put these values in session have have
them passed as headers every time?

If there is a better appraoch for the above, please let me know.

thanks in advance for your help
suneet

Re: [users@httpd] Mod-Proxy and Mod-Headers

Posted by Suneet Shah <su...@gmail.com>.
Hi Igor,

thanks for your help. I will try this out

suneet


On Wed, Sep 21, 2011 at 1:20 AM, Igor Cicimov <ic...@gmail.com> wrote:

> Hi mate,
>
> Try something like this for the example you gave
> http://host/myapp?userid=abc&role=myrole:
>
> RewriteEngine on
> Options +FollowSymLinks <http://host/myapp?userid=abc&role=myrole>
> RewriteCond QUERY_STRING userid=(.*)&role=(.*)
> RewriteRule ^/myapp$ [E=var1:%1,var2:%2]
>
> RequestHeader append userid var1
> RequestHeader append role var2
>
> This is untested and not sure about the correct syntax in the
> [E=var1:%1,var2:%2] flag, ie do you need coma or ; between the vars etc, but
> thats the general idea.
>
> Cheers,
> Igor
> On Wed, Sep 21, 2011 at 8:51 AM, Suneet Shah <su...@gmail.com>wrote:
>
>> Thanks Igor.
>>
>> Would you be able to point me to an example? I dont fully understand how I
>> can configure this to take a parameter of the query string and then set a
>> variable as a header.
>>
>> thanks for your help
>>
>>
>>
>> On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov <ic...@gmail.com> wrote:
>>
>>> Use mod_rewrite to set variable and then set that var as header.
>>>   On Sep 21, 2011 7:32 AM, "Suneet Shah" <su...@gmail.com>
>>> wrote:
>>> > Hello,
>>> >
>>> > I had a question about Mod-Proxy and Mod_headers
>>> >
>>> > 1) Is it possible to take a values that are on a query string and pass
>>> them
>>> > as headers? If so how?
>>> > For example, if I have:
>>> >
>>> > http://host/myap?userid=abc&role=myrole
>>> > I would like to take the values in the query string and pass them as
>>> headers
>>> > to the app that I am proying to
>>> >
>>> > 2) I would like to pass the above headers or query string parameters on
>>> > every request.
>>> > How can I do this? Is there a way to put these values in session have
>>> have
>>> > them passed as headers every time?
>>> >
>>> > If there is a better appraoch for the above, please let me know.
>>> >
>>> > thanks in advance for your help
>>> > suneet
>>>
>>
>>
>

Re: [users@httpd] Mod-Proxy and Mod-Headers

Posted by Igor Cicimov <ic...@gmail.com>.
Hi mate,

Try something like this for the example you gave
http://host/myapp?userid=abc&role=myrole:

RewriteEngine on
Options +FollowSymLinks <http://host/myapp?userid=abc&role=myrole>
RewriteCond QUERY_STRING userid=(.*)&role=(.*)
RewriteRule ^/myapp$ [E=var1:%1,var2:%2]

RequestHeader append userid var1
RequestHeader append role var2

This is untested and not sure about the correct syntax in the
[E=var1:%1,var2:%2] flag, ie do you need coma or ; between the vars etc, but
thats the general idea.

Cheers,
Igor
On Wed, Sep 21, 2011 at 8:51 AM, Suneet Shah <su...@gmail.com>wrote:

> Thanks Igor.
>
> Would you be able to point me to an example? I dont fully understand how I
> can configure this to take a parameter of the query string and then set a
> variable as a header.
>
> thanks for your help
>
>
>
> On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov <ic...@gmail.com> wrote:
>
>> Use mod_rewrite to set variable and then set that var as header.
>>   On Sep 21, 2011 7:32 AM, "Suneet Shah" <su...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > I had a question about Mod-Proxy and Mod_headers
>> >
>> > 1) Is it possible to take a values that are on a query string and pass
>> them
>> > as headers? If so how?
>> > For example, if I have:
>> >
>> > http://host/myap?userid=abc&role=myrole
>> > I would like to take the values in the query string and pass them as
>> headers
>> > to the app that I am proying to
>> >
>> > 2) I would like to pass the above headers or query string parameters on
>> > every request.
>> > How can I do this? Is there a way to put these values in session have
>> have
>> > them passed as headers every time?
>> >
>> > If there is a better appraoch for the above, please let me know.
>> >
>> > thanks in advance for your help
>> > suneet
>>
>
>

Re: [users@httpd] Mod-Proxy and Mod-Headers

Posted by Suneet Shah <su...@gmail.com>.
Thanks Igor.

Would you be able to point me to an example? I dont fully understand how I
can configure this to take a parameter of the query string and then set a
variable as a header.

thanks for your help


On Tue, Sep 20, 2011 at 6:29 PM, Igor Cicimov <ic...@gmail.com> wrote:

> Use mod_rewrite to set variable and then set that var as header.
>  On Sep 21, 2011 7:32 AM, "Suneet Shah" <su...@gmail.com> wrote:
> > Hello,
> >
> > I had a question about Mod-Proxy and Mod_headers
> >
> > 1) Is it possible to take a values that are on a query string and pass
> them
> > as headers? If so how?
> > For example, if I have:
> >
> > http://host/myap?userid=abc&role=myrole
> > I would like to take the values in the query string and pass them as
> headers
> > to the app that I am proying to
> >
> > 2) I would like to pass the above headers or query string parameters on
> > every request.
> > How can I do this? Is there a way to put these values in session have
> have
> > them passed as headers every time?
> >
> > If there is a better appraoch for the above, please let me know.
> >
> > thanks in advance for your help
> > suneet
>

Re: [users@httpd] Mod-Proxy and Mod-Headers

Posted by Igor Cicimov <ic...@gmail.com>.
Use mod_rewrite to set variable and then set that var as header.
 On Sep 21, 2011 7:32 AM, "Suneet Shah" <su...@gmail.com> wrote:
> Hello,
>
> I had a question about Mod-Proxy and Mod_headers
>
> 1) Is it possible to take a values that are on a query string and pass
them
> as headers? If so how?
> For example, if I have:
>
> http://host/myap?userid=abc&role=myrole
> I would like to take the values in the query string and pass them as
headers
> to the app that I am proying to
>
> 2) I would like to pass the above headers or query string parameters on
> every request.
> How can I do this? Is there a way to put these values in session have have
> them passed as headers every time?
>
> If there is a better appraoch for the above, please let me know.
>
> thanks in advance for your help
> suneet