You can configure caching, compression, routing, quality of service, log-file and web application firewall settings individually for each virtual server.
This chapter describes how to create, view, modify, and delete virtual servers. It contains the following sections:
When you create a configuration, a virtual server is created automatically with the same name as that of the configuration and is associated with the HTTP listener that was specified while creating the configuration. A default routing rule is also created for the virtual server, to distribute all requests received at the associated HTTP listener to the origin servers that were specified while creating the configuration.
You can create additional virtual servers in a configuration by using either the administration console or the CLI.
Note:
When you create a virtual server, you are, in effect, modifying a configuration. So for the new virtual-server to take effect in the Oracle Traffic Director instances, you should redeploy the configuration as described in Deploying a Configuration.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Before You Begin
Before you begin creating a virtual server, decide the following:
A unique name for the virtual server. Choose the name carefully; after creating a virtual server, you cannot change its name.
One or more unique listen ports. For information about creating listeners, see Managing Listeners.
The names of the hosts, or the host patterns, for which the virtual server will handle requests.
When a request is received, Oracle Traffic Director determines the virtual server that should process it, by comparing the Host
header in the request with the host patterns defined for each virtual server in the configuration.
The request is routed to the first virtual server that has a host pattern matching the Host
header in the request.
If the Host
header in the request does not match the host patterns defined for any of the virtual servers, or if the request does not contain the Host
header, the request is routed to the default virtual server that is associated with the HTTP listener through which the request was received.
Note:
When Strict SNI Host Matching is enabled for an HTTP listener, and if for that listener at least one of the virtual servers has certificates, then Oracle Traffic Director returns a 403-Forbidden
error to the client, if any of the following conditions is true:
The client did not send the SNI host extension during the SSL/TLS handshake.
The request does not have the Host:
header.
The host name sent by the client in the SNI host extension during the SSL/TLS handshake does not match the Host:
header in the request.
For more information, see About Strict SNI Host Matching.
The name of the origin-server pool to which the virtual server should forward requests. For information about creating origin-server pools, see Managing Origin-Server Pools.
Creating a Virtual Server Using the Administration Console
To create a virtual server by using the administration console, do the following:
To create a virtual server, run the create-virtual-server
command.
For example, the following command creates a virtual server named vs_soa
associated with the listener hl1
for the configuration soa.example.com
, and configures the virtual server to forward client requests to the origin-server pool soa-pool
.
tadm> create-virtual-server --config=soa.example.com --http-listener-name=hl1 --origin-server-pool=soa-pool vs_soa
OTD-70201 Command 'create-virtual-server' ran successfully.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about create-virtual-server
, see the Oracle Traffic Director Command-Line Reference or run the command with the --help
option.
You can view a list of virtual servers by using either the administration console or the CLI.
Note:
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Viewing List of Virtual Servers Using the Administration Console
To view a list of virtual servers by using the administration console, do the following:
You can view the properties of a virtual server by clicking on its name.
To view a list of virtual servers, run the list-virtual-servers
command, as shown in the following example:
tadm> list-virtual-servers --config=soa.example.com
name http-listener-name
----------------------------------
soa http-listener-1
adf adf-listener
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
You can view the properties of a virtual server in detail by running the get-virtual-server-prop
command.
For more information about the list-virtual-servers
and get-virtual-server-prop
commands, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help
option.
You can modify virtual servers by using either the administration console or the CLI.
Note:
When you modify a virtual server, you are, in effect, modifying a configuration. So for the new virtual-server settings to take effect in the Oracle Traffic Director instances, you should redeploy the configuration as described in Deploying a Configuration.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Modifying a Virtual Server Using the Administration Console
To modify a virtual server by using the administration console, do the following:
The CLI provides several commands (see Table 8-1) that you can use to change specific parameters of a virtual server.
Table 8-1 CLI Commands for Modifying a Virtual Server
Task/s | CLI Command/s |
---|---|
Enable or disable a virtual server; change the host, the HTTP listener, name and location of the log file; enable SSL/TLS by associating an RSA, or an ECC certificate, or both (see also: Associating Certificates with Virtual Servers and Configuring Log Preferences |
|
Create and manage caching rules (see Tuning Caching Settings |
|
Create and manage compression rules (see Enabling and Configuring Content Compression) |
|
Change QoS settings |
|
Change request limiting settings (see Preventing Denial-of-Service Attacks) |
|
Create and manage routes (see Configuring Routes) |
|
Create and manage error pages |
|
For example, the following command changes the location of the error log file for the virtual server soa
to /home/log/errors.log
.
tadm> set-virtual-server-prop --config=soa --vs=soa log-file=/home/log/errors.log
OTD-70201 Command 'set-virtual-server-prop' ran successfully.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about the CLI commands mentioned in this section, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help
option.
When you create a configuration, a virtual server is automatically created with the listener that you specified while creating the configuration. For the automatically created virtual server, as well as for any virtual server that you add subsequently in the configuration, a default route is created. The default route rule specifies that all requests to the virtual server should be routed to the origin-server pool that you specified while creating the virtual server. The default route of a virtual server cannot be deleted, but you can change its properties.
You can create additional routes for the virtual server, to route requests that satisfy specified conditions to specific origin-server pools. For example, in a banking software solution, if customer transactions for loans and deposits are processed by separate applications, you can host each of those applications in a separate origin-server pool behind an Oracle Traffic Director instance. To route customer requests to the appropriate origin-server pool depending on whether the request pertains to the loans or deposits applications, you can set up two routes as follows:
Route 1: If the request URI starts with /loan
, send the request to the origin-server pool that hosts the loans application.
Route 2: If the request URI starts with /deposit
, send the request to the origin-server pool that hosts the deposits application.
When a virtual server that is configured with multiple routes receives a request, it checks the request URI against each of the available routes. The routes are checked in the order in which they were created.
If the request satisfies the condition in a route, Oracle Traffic Director sends the request to the origin-server pool specified for that route.
If the request does not match the condition in any of the defined routes, Oracle Traffic Director sends the request to the origin-server pool specified in the default route.
WebSocket upgrade is enabled by default. In the Administration Console, use the WebSocket Upgrade check box to enable or disable WebSocket protocol for a route. Similarly, WebSocket protocol can also be enabled or disabled using the websocket-upgrade-enabled
property, which can be set using the set-route-prop CLI command. For more information, see Oracle Traffic Director Command-Line Reference.
You can configure routes in a virtual server by using either the administration console or the CLI.
Note:
When you modify a virtual server, you are, in effect, modifying a configuration. So for the new virtual-server settings to take effect in the Oracle Traffic Director instances, you should redeploy the configuration as described in Deploying a Configuration.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Configuring Routes Using the Administration Console
To configure routes by using the administration console, do the following:
Log in to the administration console, as described in Accessing the Administration Console.
Click the Configurations button that is situated at the upper left corner of the page.
A list of the available configurations is displayed.
Select the configuration for which you want to configure routes.
In the navigation pane, expand Virtual Servers, expand the name of the virtual server for which you want to configure routes, and select Routes.
The Routes page is displayed. It lists the routes that are currently defined for the virtual server.
Creating a Route
Click New Route.
The New Route dialog box is displayed.
In the Name field, enter a name for the new route.
In the Origin Server Pool field, select the origin-server pool to which requests that satisfy the specified condition should be routed.
Click Next.
In the Condition Information pane, select a Variable/Function and an Operator from the respective drop-down lists, and provide a value in the Value field.
Select the and
/or
operator from the drop-down list when configuring multiple expressions. Similarly, use the Not
operator when you want the route to be applied only when the given expression is not true.
Click Ok.
To enter a condition manually, click Cancel and then click Edit Manually. In the Condition field, specify the condition under which the routing rule should be applied. For information about building condition expressions, click the help button near the Condition field or see "Using Variables, Expressions, and String Interpolation" in the Oracle Traffic Director Configuration Files Reference.
Click Next and then click Create Route.
The route that you just created is displayed on the Routes page.
In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Deploying a Configuration.
Editing a Route
To change the settings of a route, do the following:
Click the Name of the route.
The Route Settings page is displayed.
Specify the parameters that you want to change.
On-screen help and prompts are provided for all of the parameters.
When you change the value in a field or tab out of a text field that you changed, the Save button near the upper right corner of the page is enabled.
At any time, you can discard the changes by clicking the Reset button.
After making the required changes, click Save.
A message, confirming that the updated configuration was saved, is displayed in the Console Messages pane.
In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Deploying a Configuration.
Deleting a Route Rule
To delete a route rule, click the Delete button. At the confirmation prompt, click OK.
Configuring Routes Using the CLI
To create a route, run the create-route
command.
Examples:
The following command creates a route named loan-route
in the virtual server soa.example.com
of the configuration soa
, to send requests for which the URI matches the pattern /loan
to the origin-server pool loan-app
.
tadm> create-route --config=soa --vs=soa.example.com --condition="$uri='/loan'" --origin-server-pool=loan-app loan-route
OTD-70201 Command 'create-route' ran successfully.
The following command creates a route named images-route
in the virtual server soa.example.com
of the configuration soa
, to send requests for which the URI path matches the pattern /images
to the origin-server pool images-repo
.
tadm> create-route --config=soa --vs=soa.example.com --condition="$path='/images/*'" --origin-server-pool=images-repo images-route
OTD-70201 Command 'create-route' ran successfully.
The following command creates a route named subnet-route
in the virtual server soa.example.com
of the configuration soa
, to send requests from any client in the subnet 130.35.46.*
to the origin-server pool dedicated-osp
.
tadm> create-route --config=soa --vs=soa.example.com --condition="$ip='130.35.45.*'" --origin-server-pool=dedicated-osp subnet-route
OTD-70201 Command 'create-route' ran successfully.
The following command creates a route named body-route
in the virtual server soa.example.com
of the configuration soa
, to route requests to the origin-server pool dedicated-osp
if the request body contains the word alpha.
tadm> create-route --config=soa --vs=soa.example.com --condition="$body ='alpha'" --origin-server-pool=dedicated-osp body-route
OTD-70201 Command 'create-route' ran successfully.
Note that the value of the --condition
option should be a regular expression. For information about building condition expressions, see "Using Variables, Expressions, and String Interpolation" in the Oracle Traffic Director Configuration Files Reference.
To view a list of the routes defined for a virtual server, run the list-routes
command, as shown in the following example:
tadm> list-routes --config=soa --vs=soa.example.com
route condition
-------------------------
loan-route "$uri = '/loan'"
default-route -
To view the properties of a route, run the get-route-prop
command, as shown in the following example:
tadm> get-route-prop --config=soa --vs=soa.example.com --route=loan-route
keep-alive-timeout=15
sticky-cookie=JSESSIONID
condition="$uri = '/loan'"
validate-server-cert=true
always-use-keep-alive=false
origin-server-pool=origin-server-pool-1
sticky-param=jsessionid
route-header=Proxy-jroute
rewrite-headers=location,content-location
use-keep-alive=true
route=loan-route
log-headers=false
route-cookie=JROUTE
timeout=300
To change the properties of a route, run the set-route-prop
command.
Examples:
The following command changes the keep-alive timeout setting for the route named loan-route
in the virtual server soa.example.com
of the configuration soa
to 30 seconds.
tadm> set-route-prop --config=soa --vs=soa.example.com --route=loan-route keep-alive-timeout=30
The following command enables logging of the headers that Oracle Traffic Director sends to, and receives from, the origin servers associated with the route named default-route
in the virtual server soa.example.com
of the configuration soa
.
tadm> set-route-prop --config=soa --vs=soa.example.com --route=default-route log-headers=true
To delete a route, run the delete-route
command, as shown in the following example:
tadm> delete-route --config=soa --vs=soa.example.com loan-route
OTD-70201 Command 'delete-route' ran successfully.
To disable WebSocket support, run the set-route-prop
command with the websocket-upgrade-enabled
property, as shown in the following example:
tadm> set-route-prop --config=soa --vs=soa.example.com --route=default-route websocket-upgrade-enabled=false OTD-70201 Command 'set-route-prop' ran successfully.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about the CLI commands mentioned in this section, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help
option.
You can copy a virtual server by using either the administration console or the CLI.
Note:
When you copy a virtual server, you are, in effect, modifying a configuration. So for the new virtual server to take effect in the Oracle Traffic Director instances, you should redeploy the configuration as described in Deploying a Configuration.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Copying a Virtual Server Using the Administration Console
To copy a virtual server by using the administration console, do the following:
To copy a virtual server, run the copy-virtual-server
command.
For example, the following command creates a copy (vs2
) of the virtual server vs1
.
tadm> copy-virtual-server --config=soa --vs=vs1 vs2OTD-70201 Command 'copy-virtual-server' ran successfully.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about copy-virtual-server
, see the Oracle Traffic Director Command-Line Reference or run the command with the --help
option.
You can delete virtual servers by using either the administration console or the CLI.
Note:
When you delete a virtual server, you are, in effect, modifying a configuration. So for the configuration changes to take effect in the Oracle Traffic Director instances, you should redeploy the configuration as described in Deploying a Configuration.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Deleting a Virtual Server Using the Administration Console
To delete a virtual server by using the administration console, do the following:
To delete a virtual server, run the delete-virtual-server
command, as shown in the following example:
tadm> delete-virtual-server --config=soa vs1
OTD-70201 Command 'delete-virtual-server' ran successfully.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about delete-virtual-server
, see the Oracle Traffic Director Command-Line Reference or run the command with the --help
option.