Liferay控制面板的返回URL问题:http://one:8080/group/control_panel/null

在liferay的测试环境的ip变更后,控制面板的返回URL为http://one:8080/group/control_panel/null了。

发现配置文件中的IP没有及时修改。

##
## Redirect
##

    #
    # Set this property to "ip" or "domain" for the redirect security method. If
    # set to "domain", the portal will only redirect users to domains listed in
    # the property "redirect.url.domain.allowed". If set to "ip", the portal
    # will only redirect to domains whose IP address resolve to an IP address
    # listed in the property "redirect.url.ip.allowed".
    #
    #redirect.url.security.mode=domain
    redirect.url.security.mode=ip

    #
    # Input a list of comma delimited domains which the portal is allowed to
    # redirect to. Input a blank list to allow any domain.
    #
    redirect.url.domains.allowed=

    #
    # Input a list of comma delimited IPs which the portal is allowed to
    # redirect to. Input a blank list to allow any IP. SERVER_IP will be
    # replaced with the IP of the host server.
    #
    redirect.url.ips.allowed=127.0.0.1,SERVER_IP
    redirect.url.ips.allowed=
    

原来的设置类似如下:
redirect.url.ips.allowed=127.0.0.1,192.168.0.1

虚拟主机对应不起来,所以就变为null。

解决办法:

1,这个地方设置为空:

redirect.url.ips.allowed=

2,设置虚拟主机的IP地址。

redirect.url.ips.allowed=127.0.0.1,虚拟主机的IP

为啥呢?看看代码就知道了。

 public String escapeRedirect(String url) {
		if (Validator.isNull(url) || !HttpUtil.hasDomain(url)) {
			return url;
		}

		try {
			String securityMode = PropsValues.REDIRECT_URL_SECURITY_MODE;

			String domain = StringUtil.split(
				HttpUtil.getDomain(url), StringPool.COLON)[0];

			if (securityMode.equals("domain")) {
				String[] allowedDomains =
					PropsValues.REDIRECT_URL_DOMAINS_ALLOWED;

				if ((allowedDomains.length > 0) &&
					!ArrayUtil.contains(allowedDomains, domain)) {

					if (_log.isDebugEnabled()) {
						_log.debug("Redirect URL " + url + " is not allowed");
					}

					url = null;
				}
			}
			else if (securityMode.equals("ip")) {
				String[] allowedIps = PropsValues.REDIRECT_URL_IPS_ALLOWED;

				InetAddress inetAddress = InetAddress.getByName(domain);

				if ((allowedIps.length > 0) &&
					!ArrayUtil.contains(
						allowedIps, inetAddress.getHostAddress())) {

					String serverIp = getComputerAddress();

					if (!serverIp.equals(inetAddress.getHostAddress()) ||
						!ArrayUtil.contains(allowedIps, "SERVER_IP")) {

						if (_log.isDebugEnabled()) {
							_log.debug(
								"Redirect URL " + url + " is not allowed");
						}

						url = null;
					}
				}
			}
		}
		catch (UnknownHostException uhe) {
			if (_log.isDebugEnabled()) {
				_log.debug("Unable to determine IP for redirect URL " + url);
			}

			url = null;
		}

		return url;
	}


你可能感兴趣的:(String,Security,url,domain,input,redirect)