If you need to protect your web-application, deployed to the Jetty application server, within denying access for a client with particular IP address, follow the next short instruction:
Open the configuration manager (press Config button) for Jetty server in the environment with your application deployed.
Navigate to the /opt/jetty/work/Jetty_0_0_0_0_8080_webapps_.__.h3czus/webapp directory of your deployed web application and create the .htaccess file.
Specify the IP restrictions in the newly created file. As an example you can use the following code, which allows access only for 192.168.152.1 IP address:
deny from all
allow from 192.168.152.1
Navigate to the /opt/jetty/contexts directory and find there the xml file, named after the context of your application (test.xml in our case).
Using the HTAccessHandler, which interacts with the early created .htaccess policy file, protect the access to your application. Eventually your context xml file will look like the following one:
6. After that Save the changes made and Restart your Jetty node.
As a result user with any IP except of the allowed one will see the next error while trying to open your application: