Page tree
Skip to end of metadata
Go to start of metadata

Problem

Default error messages reveal information about system and it's folder structure.

Solution

Customizing Tomcat error pages is described below.

  1. Edit the following file.
    1. /usr/local/ubisecure/ubilogin-sso/ubilogin/config/tomcat/conf/web.xml
  2. Add the lines below to the end of the file, but within the XML markup. The error message must be customized separately for each error code, as it is done below.
    1. <error-page>
      <error-code>400</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>401</error-code>
      <location>/error.html</location></error-page>
      <error-page>
      <error-code>403</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>404</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>405</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>408</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>410</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>411</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>412</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>413</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>414</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>415</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>500</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>501</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>502</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>503</error-code>
      <location>/error.html</location>
      </error-page>
      <error-page>
      <error-code>506</error-code><location>/error.html</location>
      </error-page>
    1. Copy the web.xml to the Tomcat work directory
        cp /usr/local/ubisecure/ubilogin-sso/ubilogin/config/tomcat/conf/web.xml

      /usr/local/ubisecure/ubilogin-sso/tomcat/conf/web.xml
    1. The customized error page is added with the name error.html. Customize as you wish.
    1. echo "ERROR - Customize this text as desired" > /usr/local/ubisecure/ubilogin-sso/ubilogin/webapps/ROOT/error.html
    1. Run update command and restart SSO Service
      /usr/local/ubisecure/ubilogin-sso/ubilogin/config/tomcat/update.sh
      service ubilogin-server restart