Valve in server .xml to get the client IP

Linux debian 10
apache 2.4
Java : 1.0.15
Lucee 5.3.9.133

When I add this line :
Valve className=“org.apache.catalina.valves.RemoteIpValve”
just after the line
Engine name=“Catalina” defaultHost=“localhost”
in the server.xml of tomcat conf
Lucee does not work anymore

This is to get the right Client IP instead of 127.0.0.1

Thanks for any idea.

You may want to be more explicit. First, what do you mean specifically about Lucee “not working anymore”? Does the service or process not start? Does it start, but all cf pages (including the admin) fail? It there any error message, on-screen or in the logs?

And when you put in the valve xml element, did you make it self-closing, with a / before the closing >? That’s necessary and could be easy to miss, and the lucee (or cf) might then “start” but be unable to process cfml pages.

You can look to the Tomcat docs for an example of the xml, as well as some additional attributes that may be needed if you don’t get the expected ip address once things are “working”. I cover both (the docs and those attributes) in a post I did on leveraging this tomcat remoteipvalve feature–albeit from an ACF perspective, since it was posted in the cf portal, but the use with Tomcat is identical whether running CF or Lucee.

Let us know if your problem remains after considering the above.

1 Like

Sorry, Lucee does work
But I loose the DB access when adding the line with the valve to get RemoteIp
Error is
com/healthmarketscience/jackcess/util/ErrorHandler
(Ucanaccess driver for Access)

In an other environment (other server) , it did work
Debian 10 (same) and Lucee 5.3.7.47
Now I have Lucee 5.3.9.133

I have added the / at the end of line code closing, same error.

Thanks for any idea

Pierre, I don’t readily see any connection between trying to use the remoteipvalve and the jackcess (ucanaccess?) driver.

Are you sure that’s the ONLY thing about Lucee that’s not working? If you make a mistake setting up the server.xml, it can be that Lucee (or ACF) will start but not run requests.

OK, sorry, I think it does work now.
I had to stop lucee , delete the Jackcess files,
Restart Lucee
Replace the Jackcess files In lucee folder (as they were before)
Stop Lucee, and Restart Lucee
All is working.

1 Like