Bug 57311 - BalancerMember enclosed by <If> gives syntax error
Summary: BalancerMember enclosed by <If> gives syntax error
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.4.10
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2014-12-04 17:10 UTC by Spyridon Gouliarmis
Modified: 2015-10-21 18:51 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Spyridon Gouliarmis 2014-12-04 17:10:35 UTC
When the following code is in httpd.conf:

<VirtualHost *:${SOAP_PORT_STD}>
    ErrorLog ${ROOT}/logs/soapd.log

    SSLEngine Off

    KeepAlive Off
    ProxyPass / balancer://cluster:8080/
    ProxyPassReverse / balancer://cluster:8080/
    <Proxy balancer://cluster>
        BalancerMember http://${SERVER_ADDR1}:8080/ timeout=55 retry=10 max=250
	<If "osenv('SERVER_ADDR2') != ''">
	    <If "osenv('SERVER_MODE') =~ /^ordered$/">
	    	BalancerMember http://${SERVER_ADDR2}:8080/ status=+H timeout=55 retry=10 max=250
		BalancerMember http://${SERVER_ADDR2}:8080/ timeout=55 retry=10 max=250

I get the following error:

AH00526: Syntax error on line 456 of /opt/gobbledygook/lib/httpd.conf:
BalancerMember Bad syntax for a balancer name

Line 456 refers to the following:

BalancerMember http://${SERVER_ADDR2}:8080/ status=+H timeout=55 retry=10 max=250

I tried replacing the line with simpler ones, such as:


but still the same error. A line such as:

SetOutputFilter INCLUDES

instead will raise no error, though.
Comment 1 Spyridon Gouliarmis 2014-12-04 17:13:18 UTC
(I mean I get the error on Apache startup.)
Comment 2 Eric Covener 2014-12-04 17:16:29 UTC
I don't think BalancerMember is designed to be used outside of (plain) Location and <Proxy> configuration sections.  Will leave PR open a few days.
Comment 3 Christophe JAILLET 2015-05-19 06:28:10 UTC

This is because of:
     * Set a dummy value so that other directives notice that they are inside
     * a config section.
    cmd->path = "*If";
around line 2485 in core.c

This breaks the processing of BalancerMember.

What is the goal of this?
Comment 4 Spyridon Gouliarmis 2015-05-19 08:46:29 UTC
The original goal was to make a configurable reverse proxy. We figured Apache's configuration could be adapted at launch through environment variables and <If> blocks.

We just worked around the issue by building the right Apache configuration in a launcher script and including it whole through an environment variable in Apache's configuration.
Comment 5 Christophe JAILLET 2015-05-19 09:40:30 UTC
> What is the goal of this?

Your goal is clear.

My question was not explicit enought.
I meant: "what is the goal of such a behaviour in <if > processing (i.e. cmd->path = "*If";)"

In other words: "could ifsection() be modified to allow the kind of construction you tried to use?"
Comment 6 Keith 2015-10-21 18:51:40 UTC
I just ran into this as well.  What is the current status on the issue.