Validate the URL host and port for cloud access

In a cloud environment, there are many things to consider when accessing URLs from your application.

  1. Does the host name or IP address need to change?
  2. Can the host be accessed from the cloud environment?
  3. Can the port be accessed from the cloud environment?
  4. Can the host name or IP address change dynamically in the cloud environment after deployment?
  5. If the host name is localhost, did the target service move with the application?

This rule flags references to the following in Java string literals and in property values in .properties files:

If the target cloud runtime environment is IBM Cloud or Third-party PaaS, the following protocols are not flagged by this rule because they are flagged by the Do not use older or non-standard protocols rule.

This rule also flags references to "http://" or "https://" in the location attribute on the <address> element in WSDL files.

Note: References to "http://www.w3.org/" and "http://schemas.xmlsoap.org/" are not flagged because they identify defined namespaces in the Web Services Addressing specification.

How to Resolve

If your application is able to directly access the service endpoint or peer, no further action is required. Otherwise, there are two potential solutions:

Create a Secure Connection

You can use a VPN tunnel, such as the IBM Secure Gateway for IBM Cloud, to create a secure connection to your service endpoint or peer. For more information about configuring a secure connection, see Configuring a VPN. After configuring your gateway, connect your application to the new destination by using the cloud host and port number that is provided when you created the destination.

Open a Port

Only certain ports are open by default in a cloud environment. For information on how to open additional ports, see the Firewall Ports section in WebSphere Application Server in IBM Cloud System access.

For more information, see Top 9 rules for cloud applications.