code: public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
          //PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
          //we will do it, is if the value of the cookie is null. This will solve the Error 500.
          if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "Will not update the WASReqURL cookie");
          } else {
              if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
                  url = removeHostNameFromURL(url);
              }
              url = encodeURL(url);
              authResult.setCookie(createReferrerUrlCookie(req, url));
              if (tc.isDebugEnabled()) {
                  Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
                  Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
              }
          }
      }
docs: Sets the referrer URL cookie into the AuthenticationResult. If
  PRESERVE_FULLY_QUALIFIED_REFERRER_URL is not set, or set to false,
  then the host name of the referrer URL is removed.
  
  @param authResult AuthenticationResult instance
  @param url non-null URL String
  @param securityConfig SecurityConfig instance