Add a WebSocket handshake rule, which lets you define the domains that can open a cross-origin WebSocket to the application or resource.
You can also define allowed WebSocket subprotocols and extensions, providing more fine-grained control over how the application behaves.
- Click Access and then go to Rules > Rules.
- Click + Add Rule.
-
In the Name field, enter a unique name up to 64
characters long.
Special characters and spaces are allowed.
- From the Type list, select WebSocket Handshake.
-
In the Allowed Origins, enter one or more origins.
If no origins are defined, all cross-origin WebSocket requests are denied.
Important:Avoid using a value of
*
in this field. While this is a valid configuration, it is considered an insecure practice. -
Modify the list of Allowed
Subprotocols.
Subprotocols are defined in the
Sec-WebSocket-Protocol
handshake header. The default value of*
allows all subprotocols. -
Modify the list of Allowed
Extensions.
WebSocket extensions are defined in the
Sec-WebSocket-Extensions
handshake header. The default value of*
allows all extensions. - Optional:
To configure rejection handling, click Show Advanced
Settings, then select a rejection handling method:
- If you select Default, use the Rejection Handler list to select an existing rejection handler that defines whether to display an error template or redirect to a URL.
- If you select Basic, you can customize an error
message to display as part of the default error page rendered in the end user's
browser if rule evaluation fails. This page is among the templates you can
modify with your own branding or other information. If you select
Basic, provide this information:
- In the Error Response Code field, enter the HTTP status response code to send if rule evaluation fails. The default is 403.
- In the Error Response Status Message field, enter the HTTP status response message to send if rule evaluation fails. The default is Forbidden.
- In the Error Response Template File field, enter the HTML template page for customizing the error message that displays if rule evaluation fails. This template file is located in the <PA_HOME>/conf/template/ directory.
- From the Error Response Content Type list, select the type of content for the error response. This lets the client properly display the response.
If you select Basic, you can customize an error message to display as part of the default error page rendered in the end-user's browser if rule evaluation fails. This page is among the templates you can modify with your own branding or other information. If you select Basic, provide this information: - Click Save.