You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marcos Filho <ma...@gmail.com> on 2012/04/16 16:25:02 UTC

[users@httpd] Add a http header if the request comes from an iphone

Hello Guys,

I have the following requirement:

"Add a http header if the request is from an iphone."
ps: this request will be proxied to a apache tomcat server with mod_proxy.

I have checked the mod_headers documentation and it says to use the
mod_setenvif

My apache's version is 2.2.19 and I am trying this configuration:

SetEnvIf %{HTTP_USER_AGENT} value "iphone" [NC]
RequestHeader add deviceType  "HighEnd"

Also, I tried this:
SetEnvIf User-Agent value "iphone" [NC]
RequestHeader add deviceType  "HighEnd"

Those "SerEnvIf" are not working and probably I am doing something wrong.

I have done lots of research on google and then tried lots of settings but
nothing is working.

Do you guys have an idea how I can get it working? I would really
appreciate your help.

Regards,
Marcos

Re: [users@httpd] Add a http header if the request comes from an iphone

Posted by Marcos Filho <ma...@gmail.com>.
Hi Eric,

Thank you so much.
I took your advice and I think it is working now.

I did the following configurarion:

BrowserMatchNoCase  iphone is_iphone
RequestHeader add deviceType  "HighEnd" env=is_iphone

Is it what you mean?

Regards,
Marcos

On Mon, Apr 16, 2012 at 11:39 AM, Eric Covener <co...@gmail.com> wrote:

> On Mon, Apr 16, 2012 at 10:31 AM, Marcos Filho <ma...@gmail.com>
> wrote:
> > Yes, I did copy from my configurations.
> >
> > I know that this line works if it is isolated:
> > 'RequestHeader add deviceType  "HighEnd" '
> >
> > But I need to check if the request is from an iphone, and that condition
> is
> > not working at all.
> >
> > Do you have any idea how I can fix it?
>
> Use setenvif to heck the user-agent, and set an environment variable
> Then use th eoption for RequestHEader to depend on an environment variable.
>
> >
> >
> > On Mon, Apr 16, 2012 at 11:27 AM, Eric Covener <co...@gmail.com>
> wrote:
> >>
> >> > SetEnvIf %{HTTP_USER_AGENT} value "iphone" [NC]
> >> > RequestHeader add deviceType  "HighEnd"
> >> >
> >> > SetEnvIf User-Agent value "iphone" [NC]
> >> > RequestHeader add deviceType  "HighEnd"
> >>
> >> This  seems completely wrong, did you copy and paste from your
> >> configuration?
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >> For additional commands, e-mail: users-help@httpd.apache.org
> >>
> >
>
>
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Add a http header if the request comes from an iphone

Posted by Eric Covener <co...@gmail.com>.
On Mon, Apr 16, 2012 at 10:31 AM, Marcos Filho <ma...@gmail.com> wrote:
> Yes, I did copy from my configurations.
>
> I know that this line works if it is isolated:
> 'RequestHeader add deviceType  "HighEnd" '
>
> But I need to check if the request is from an iphone, and that condition is
> not working at all.
>
> Do you have any idea how I can fix it?

Use setenvif to heck the user-agent, and set an environment variable
Then use th eoption for RequestHEader to depend on an environment variable.

>
>
> On Mon, Apr 16, 2012 at 11:27 AM, Eric Covener <co...@gmail.com> wrote:
>>
>> > SetEnvIf %{HTTP_USER_AGENT} value "iphone" [NC]
>> > RequestHeader add deviceType  "HighEnd"
>> >
>> > SetEnvIf User-Agent value "iphone" [NC]
>> > RequestHeader add deviceType  "HighEnd"
>>
>> This  seems completely wrong, did you copy and paste from your
>> configuration?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Add a http header if the request comes from an iphone

Posted by Marcos Filho <ma...@gmail.com>.
Yes, I did copy from my configurations.

I know that this line works if it is isolated:
'RequestHeader add deviceType  "HighEnd" '

But I need to check if the request is from an iphone, and that condition is
not working at all.

Do you have any idea how I can fix it?


On Mon, Apr 16, 2012 at 11:27 AM, Eric Covener <co...@gmail.com> wrote:

> > SetEnvIf %{HTTP_USER_AGENT} value "iphone" [NC]
> > RequestHeader add deviceType  "HighEnd"
> >
> > SetEnvIf User-Agent value "iphone" [NC]
> > RequestHeader add deviceType  "HighEnd"
>
> This  seems completely wrong, did you copy and paste from your
> configuration?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Add a http header if the request comes from an iphone

Posted by Eric Covener <co...@gmail.com>.
> SetEnvIf %{HTTP_USER_AGENT} value "iphone" [NC]
> RequestHeader add deviceType  "HighEnd"
>
> SetEnvIf User-Agent value "iphone" [NC]
> RequestHeader add deviceType  "HighEnd"

This  seems completely wrong, did you copy and paste from your configuration?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org