Search code examples
apachewsgiajp

How do I convince mod_proxy_ajp to pass environment variables to its backend?


I'm trying to use Apache's mod_proxy with the AJP backend and an ajp-wsgi app server but it doesn't seem to be sending SetEnv variables to the application server.

Configuration snippet:

<Location /script>
    ProxyPass ajp://localhost:8009/script
    SetEnv FOO "barbobot"
</Location>

How do I pass environment variables from the Apache configuration to my app server?


Solution

  • The trick is to prefix the environment varibles with AJP_, as in

    <Location /script>
        ProxyPass ajp://localhost:8009/script
        SetEnv AJP_FOO "barbobot"
    </Location>
    

    See http://marc.info/?l=apache-httpd-dev&m=122059722411298&w=2