Follow these steps to configure the Websocket Upgrade policy for
DataPower® Gateway (v5 compatible) in the assembly
user interface.
About this task
For details on how to configure the policy in your OpenAPI source, see websocket-upgrade.
Procedure
-
In the navigation pane, click
Develop, then select the APIs tab.
The Develop page
opens.
-
Click the title of the API that you want to work with, or create a new API.
- Select the Gateway tab, then click
Policies in the navigation pane.
For more information about
working with the assembly editor for an API, see
The assembly editor.
- Find the Websocket Upgrade policy in the
palette, and drag the policy onto your canvas.
- Specify the following properties.
Table 1. Websocket Upgrade policy
properties
Property label |
Required |
Description |
Data type |
Title |
No |
The title of the policy. The default value is websocket-upgrade .
|
string |
Description |
No |
A description of the policy. |
string |
URL |
Yes |
Specify the URL to be invoked. |
string |
TLS Profile |
No |
Specifies a TLS profile to use for the secure transmission of data. |
string |
Timeout |
No |
The time to wait before a reply back from the endpoint (in seconds). The default value is
60 .
|
integer |
Follow redirects |
No |
Specifies the behavior if the back-end server returns the HTTP status code 301 Moved
Permanently . If you select this check box, the invoke policy follows the
URL redirection by making a further call to the URL specified in the Location
header in the response. If you clear this check box, the invoke saves the
301 status code and the API call is considered to be complete.Note: The
follow-redirect property is supported only by the DataPower API Gateway. If you are using
the DataPower Gateway (v5 compatible), the
invoke always follows the URL redirection; the proxy policy (not supported by the DataPower API Gateway) saves the
301 status code and completes the API call without following the URL
redirection.
|
boolean |
Username |
No |
The username to use for HTTP Basic authentication. |
string |
Password |
No |
The password to use for HTTP Basic authentication. |
string |
Inject proxy headers |
No |
If you select this check box, the invoke policy injects the
X-Forwarded-For , X-Forwarded-To ,
X-Forwarded-Host , and X-Forwarded-Proto headers to the request
that is sent to the target URL.The check box is cleared by default.
|
boolean |
Decode Request Params |
No |
If you select this check box, any request parameters that are referenced by a variable
definition on the target URL of the invoke policy are URL-decoded. The check box is cleared by
default.
|
boolean |
Queryparam encode |
No |
If you select this check box, all "+" characters in the query parameter values of the target
URL are encoded to %2F. The check box is cleared by default.
|
boolean |
Request assembly |
No |
The request processing assembly. For details on configuring an assembly in the
execute section, see execute. For
example:request-assembly:
execute
.
.
.
policy assembly
.
.
.
|
object |
Response assembly |
No |
The response processing assembly. For details on configuring an assembly in the
execute section, see execute. For
example:response-assembly:
execute
.
.
.
policy assembly
.
.
.
|
object |
- Specify a version for the policy by clicking the Source icon
,
and completing the
version
section of the policy YAML. For
example: execute:
- websocket-upgrade:
version: 1.0.0
title: websocket-upgrade
...
You must specify a version for the policy that is compatible with the gateway that
you are using. When the API is published, if the version is incompatible with the gateway, a
validation error is thrown that specifies the available versions.
- Click Save.