How do you get the user's IP address with tomcat behind apache using mod_jk

Using the recommend Vaadin code to get an IP address in a setup with apache on the front and tomcat behind using mod_jk always results in getting the Server’s IP address:


I caught [this snippet]
which explains it’s because the connection is coming from Apache, which makes sense, but that solution doesn’t work either.

Therefore my question is how do I get the actual user’s IP address in Vaadin 8 when the tomcat server is behind apache using mod_jk?


Thank you for confirming this. That’s also I understood from the link in my original post, so I was confused why it didn’t work. Turns out I had a typo in the header string. Here I thought it was the method that didn’t work and didn’t realize it was a typo. Thank you again for confirming it, it really helped and was much appreciated.

Typicall the original IP address can be found in the X-Forwarded-For request header ( You can get the current request using VaadinRequest.getCurrent() so something like VaadinRequest.getCurrent().getHeader("X-Forwarded-For") should work