You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Naveen Nandyala <Na...@walmart.com.INVALID> on 2019/01/24 23:00:12 UTC

[users@httpd] Can I use If condition against custom header name that my request is passing in Apache 2.4

We are using Apache 2.4.12, I’m working to set a host in header based on header value passed in my request, was wondering if I can use IF statement to get the same, Request hitting my Apache server is having a header with header name “X-Proxy” and header value is Set to “Torbit”.

When this request with that header name hits my Apache I need to perform below action. Else it should not.

RequestHeader set Host cert-one.domain.com

I’m trying to do this in my virtualhost section as below.

<If "%{HTTP:X-Proxy} in { 'Torbit }">
               RequestHeader set Host cert-one.domain.com
</If>

This gives me below error while starting.

\n AH00526: Syntax error on line 8 of /u/applic/tc/HTTP/config/vhosts-ssl/wr-cleartrust/benefits-stage.wal-mart.com-vhost.conf:
Cannot parse condition clause: Unterminated string or variable \n

Any help will be appreciated.

Naveen Reddy



[users@httpd] Re: Can I use If condition against custom header name that my request is passing in Apache 2.4

Posted by Christophe JAILLET <ch...@wanadoo.fr>.
Le 25/01/2019 à 00:00, Naveen Nandyala a écrit :
>
> We are using Apache 2.4.12, I’m working to set a host in header based 
> on header value passed in my request, was wondering if I can use IF 
> statement to get the same, Request hitting my Apache server is having 
> a header with header name “X-Proxy” and header value is Set to “Torbit”.
>
> When this request with that header name hits my Apache I need to 
> perform below action. Else it should not.
>
> *RequestHeader set Host cert-one.domain.com*
>
> I’m trying to do this in my virtualhost section as below.
>
> <If "%{HTTP:X-Proxy} in { 'Torbit }">
>
> RequestHeader set Host cert-one.domain.com
>
> </If>
>
> This gives me below error while starting.
>
> \n AH00526: Syntax error on line 8 of 
> /u/applic/tc/HTTP/config/vhosts-ssl/wr-cleartrust/benefits-stage.wal-mart.com-vhost.conf:
>
> Cannot parse condition clause: Unterminated string or variable \n
>
> Any help will be appreciated.
>
> *Naveen Reddy*
>
Hi, a ' seems to be missing after Torbit.

CJ


[users@httpd] RE: Can I use If condition against custom header name that my request is passing in Apache 2.4

Posted by "Muggeridge, Matt" <ma...@hpe.com>.
Ø  Cannot parse condition clause: Unterminated string or variable \n

Did you try terminating your string?

Check your syntax.

Matt.

From: Naveen Nandyala [mailto:Naveen.Nandyala0@walmart.com.INVALID]
Sent: Friday, 25 January 2019 9:00 AM
To: users@httpd.apache.org
Subject: [users@httpd] Can I use If condition against custom header name that my request is passing in Apache 2.4

We are using Apache 2.4.12, I’m working to set a host in header based on header value passed in my request, was wondering if I can use IF statement to get the same, Request hitting my Apache server is having a header with header name “X-Proxy” and header value is Set to “Torbit”.

When this request with that header name hits my Apache I need to perform below action. Else it should not.

RequestHeader set Host cert-one.domain.com

I’m trying to do this in my virtualhost section as below.

<If "%{HTTP:X-Proxy} in { 'Torbit }">
               RequestHeader set Host cert-one.domain.com
</If>

This gives me below error while starting.

\n AH00526: Syntax error on line 8 of /u/applic/tc/HTTP/config/vhosts-ssl/wr-cleartrust/benefits-stage.wal-mart.com-vhost.conf:
Cannot parse condition clause: Unterminated string or variable \n

Any help will be appreciated.

Naveen Reddy