Configure a Custom URL for an Application Deployed to a Service Instance

You can use Oracle Traffic Director to define a custom "vanity" URL for an application deployed to an Oracle Java Cloud Service instance.

For example, if you have a shopping cart application deployed with the following context root: /shopping-cart/widgets, by default users would access the application using a URL that includes the context root details, such as http://example.com/shopping-cart/widgets. Let's say that you want to simplify this URL to http://example.com. You can accomplish this by modifying the load balancer configuration.

By default, if you created your service instance in an Oracle Cloud Infrastructure Classic region, external access to the load balancer console is disabled for security purposes. If you did not enable console access while provisioning your service instance, see Enabling Console Access in an Oracle Java Cloud Service Instance.

  1. Access the Oracle Java Cloud Service Console.
  2. Click menu icon for the desired service instance and select Open Load Balancer Console.
  3. Log in to console using the credentials defined when provisioning your service instance.

    If you created your service instance using the Oracle Java Cloud Service console, the user name and password default to the Oracle WebLogic Server Administration Console user name and password.

  4. Access the load balancer configuration (for example, opc-config):
    • If your service instance is running Oracle Traffic Director 12c, click the Target Navigation icon Target Navigation icon. Expand the Traffic Director folder and click the name of the Traffic Director configuration.
    • If your service instance is running Oracle Traffic Director 11g, click Configurations and then click the name of the Traffic Director configuration.
  5. Navigate to the Virtual Server in this configuration (for example, opc-config):
    • If your service instance is running Oracle Traffic Director 12c, click Traffic Director Configuration, select Administration, and then Virtual Servers. Click the name of the virtual server.

    • If your service instance is running Oracle Traffic Director 11g, expand Virtual Servers in the navigation pane and click the name of the virtual server.

  6. Click Routes and then click default-route.
  7. Edit these fields in the URI Mapping section:
    1. Select the Enabled checkbox.
    2. For From URI, enter the URI that should be redirected. For example, enter /.
    3. For Target URI, enter the context root for the application. For example, enter /shopping-cart/widgets.
  8. Activate your changes:
    • If your service instance is running Oracle Traffic Director 12c, click Apply.

    • If your service instance is running Oracle Traffic Director 11g, click Deploy Changes.