Allow access to Alfresco server only by name and not IP address

You many want to block access to your web server using IP address. Here's how to accomplish that:

Navigate to tomcat/webapps/share/WEB-INF

cd tomcat/webapps/share/WEB-INF

you should see the file web.xml and urlrewrite.xml, open the file

sudo vi web.xml

add the following before </web-app>:

<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>

now open urlrewrite.xml

sudo vi urlrewrite.xml

Paste the following under the <urlrewrite use-query-string="true"> line

<rule>

    <name>Canonical Hostnames</name>

    <condition name="host" operator="notequal">^alfresco.ezref.info</condition>

    <condition name="host" operator="notequal">^$</condition>

    <from>^/(.*)</from>

    <to type="redirect" last="true">https://ezref.info</to>

</rule>

Save the files and restart the server and you have locked the server to domain name