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 for CGI.LOCAL_ADDR and an empty string for CGI.SERVER_ADDR.

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

In my Apache configuration, I have:

<IfModule jk_module>

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.