2

I need to keep ProxyPass configurations in separate files due to deployment system we use in following form:

File 1:

<VirtualHost *:80>
    <Location /qa1/>
        ProxyPass http://localhost:8800/qa1/
        ProxyPassReverse http://localhost:8800/qa1/
        ProxyPassReverseCookiePath / /qa1/
    </Location>
</VirtualHost>

File 2:

<VirtualHost *:80>
    <Location /qa2/>
        ProxyPass http://localhost:8801/qa2/
        ProxyPassReverse http://localhost:8801/qa2/
        ProxyPassReverseCookiePath / /qa2/
    </Location>
</VirtualHost>

but Apache complains that: [warn] default VirtualHost overlap on port 80, the first has precedence

Any idea if/how it possible to have Apache merge the both configurations?

4

Use Include.

File 1: qa1.conf

<Location /qa1/>
    ProxyPass http://localhost:8800/qa1/
    ProxyPassReverse http://localhost:8800/qa1/
    ProxyPassReverseCookiePath / /qa1/
</Location>

File 2: qa2.conf

<Location /qa2/>
    ProxyPass http://localhost:8801/qa2/
    ProxyPassReverse http://localhost:8801/qa2/
    ProxyPassReverseCookiePath / /qa2/
</Location>

File 3: vhost.conf

<VirtualHost *:80>
    Include qa1.conf
    Include qa2.conf
</VirtualHost>
  • Thanks, problem is that it basically still requires me update the vhost.conf, rather then merging them both. – SyRenity Aug 6 '13 at 19:49
  • I don't understand why that's a problem. You only have to update it once when you make this change. Any changes to the <Location> blocks still happen in the two separate files. – Ladadadada Aug 6 '13 at 19:56
  • The problem in the deployment system, which basically oriented to separate config files. Having single file forces me to append manually these Includes. – SyRenity Aug 6 '13 at 20:01
  • 1
    Are you talking about adding more files in the future such as qa3.conf and qa4.conf which would require changing vhost.conf? You can use a wildcard in the vhost.conf file like this: Include qa/*.conf and put the qa*.conf files in the qa/ directory. – Ladadadada Aug 6 '13 at 20:12
1

just keep the Location directives separately

file qa1.conf

<Location /qa1/>
    ProxyPass http://localhost:8800/qa1/
    ProxyPassReverse http://localhost:8800/qa1/
    ProxyPassReverseCookiePath / /qa1/
</Location>

file qa2.conf

<Location /qa2/>
    ProxyPass http://localhost:8801/qa2/
    ProxyPassReverse http://localhost:8801/qa2/
    ProxyPassReverseCookiePath / /qa2/
</Location>

then

<VirtualHost *:80>
    include qa1.conf 
    include qa2.conf
</VirtualHost>
  • Same here, I would prefer to merge them rather then centrally updating a file. – SyRenity Aug 6 '13 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.