To achieve this, we used tuckey url rewrite framework to block the IP based access. The framework is already bundled in our application.Follow the below steps to block the IP based access, Assume ServiceDesk Plus server's IP address is "101.102.103.104"
Step 1 : Download the attached urlrewrite.xml file.
Step 2 : Open the urlrewrite.xml file under <SDP Home>\webapps\ROOT\WEB-INF folder. Don't modify the existing content. Copy the rule tags from attached urlrewrite.xml and paste those contents in urlrewrite.xml in last (before </urlrewrite.xml> line).
NOTE: If the urlrewrite.xml file is not exists, Save the attached urlrewrite.xml file under <SDP Home>\webapps\ROOT\WEB-INF directory.
Step 3: Replace the "101.102.103.104" IP address with ServiceDesk application installed server's IP address. Also don't remove the special chars added back and forth of IP Address.

Step 4 : Replace the acme.com with the domain name used to access the ServiceDesk Plus application.
Step 5 : If the customer's requirement is to redirect the request without displaying a 404 error page, then configure only the base URL, for example:
https://demo.servicedeskplus.com
If the server is running on a non-default port (other than 443 for HTTPS or 80 for HTTP), include the port number in the URL. For example:
Step 6 : Open the web.xml file under <SDP Home>\webapps\ROOT\WEB-INF folder. Add or edit (if exists) the below filter-mapping details(url-pattern) in web.xml in all the below context folders. This filter must added after SDPSecurityFilter.
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
NOTE: If filter mapping already exists in web.xml, the url-pattern (<url-pattern>/portal/*</url-pattern>) will be different and no dispatchers.
Step 7 : After making the above changes, copy the updated urlrewrite.xml file and paste it into all the directories listed below.
NOTE: Ensure that every WEB-INF folder contains the urlrewrite.xml file.
All Contexts :
- under webapps/ROOT/WEB-INF/ (already done)
- under webapps/sd/WEB-INF/
- under webapps/mc/WEB-INF/
- under webapps/mcp/WEB-INF/
- under logs/WEB-INF/
- under integration/resources/WEB-INF/ (if exists)
- under inlineimages/WEB-INF/
- under fos/WEB-INF/ (If exists)
- under custom/WEB-INF/
Step 8 : Same as Step 6, Add the following filter to the web.xml file in all the contexts listed in Step 7.
Ensure that this filter is placed immediately after the SdpSecurityFilter. If the web.xml file does not contain any filter definitions, add this filter at the beginning of the file.
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Step 9 : Restart the ServiceDesk Plus application server.