Getting cgi.local_addr to return Apache host address

I’ve working on getting Lucee up and running to match our ACF configuration and I’m having issues with the CGI.SERVER_ADDR and CGI.LOCAL_ADDR variables.

In ACF, this returns the address of the Apache host serving the site. However, in Lucee this is returning 127.0.0.1 for CGI.LOCAL_ADDR and an empty string for CGI.SERVER_ADDR.

I’m using Lucee 5.3.6.61 w/Apache 2.4 mod_cfml and mod_jk.

In my Apache configuration, I have:

SetEnvIfNoCase SERVER_ADDR "(.*)" LOCAL_ADDR=$1
<IfModule jk_module>
	JkEnvVar SERVER_ADDR
	JkEnvVar LOCAL_ADDR
</IfModule>

This works properly in ACF.

If I use getPageContext().getRequest().getAttribute(“SERVER_ADDR”) or getPageContext().getRequest().getAttribute(“LOCAL_ADDR”) I get the value I expect.

From all I’ve read, it seems like mod_jk should be reporting to Tomcat the correct address so that InetAddress.getLocalHost() would return the Apache hostname (which is what the code in CgiImpl is using), but it doesn’t seem to be working.

What am I missing?

Mod_jk isn’t used so much… Did you try mod_ajp?

I had other problems with mod_proxy_ajp. The ProxyPass directives run before other directives we require in Apache, where as we do not have the issue using mod_jk.

That said, I originally tried ProxyPassMatch and had the same problem.