I’m struggling to get my Apache setup to play nice with my AJP backend. I’ve got mod_proxy
running with an AJP-WSGI app server, but it’s being stubborn about sending SetEnv
variables to the app server.
Here’s a snippet of my config:
<Location /myapp>
ProxyPass ajp://127.0.0.1:8009/myapp
SetEnv MY_VAR "test_value"
</Location>
I expected this to work, but the app server isn’t getting the MY_VAR
env variable. Is there a special trick to make Apache pass these variables through the AJP proxy? I’ve been googling for hours and can’t find a clear answer. Any help would be much appreciated!
yo ryan, ever tried JkEnvVar? it’s like the secret sauce for AJP proxying. slap this in ur config:
JkEnvVar MY_VAR
works like a charm for me. might need mod_jk tho. give it a shot and lemme kno how it goes!
I’ve encountered a similar issue in the past, and the solution that worked for me was using the ProxyPassReverse
directive in conjunction with ProxyPass
. Try modifying your configuration like this:
<Location /myapp>
ProxyPass ajp://127.0.0.1:8009/myapp
ProxyPassReverse ajp://127.0.0.1:8009/myapp
SetEnv MY_VAR "test_value"
</Location>
Additionally, ensure that your AJP connector on the application server side is configured to receive environment variables. Some application servers require explicit configuration to accept and process these variables from the proxy. If this doesn’t resolve the issue, you might want to check your application server’s documentation for any specific requirements regarding environment variable handling in AJP connections.
hey there ryan! have you tried using the ProxySet directive? somethin like:
ProxySet env=MY_VAR
it might help pass those pesky variables thru. also, what version of apache are you running? some older versions can be tricky with AJP proxying. curious to hear if this helps or if you’ve found another solution?