Applies To:Show Versions
- 11.5.9, 11.5.8, 11.5.7, 11.5.6, 11.5.5, 11.5.4, 11.5.3, 11.5.2, 11.5.1
About cross-domain request enforcement
You enable cross-domain request enforcement as part of the Allowed URL properties within a security policy. Then you can specify which domains can access the response generated by requesting this URL (the “resource”), and also configure how to overwrite CORS response headers that are returned by the web server.
This feature does not affect internal redirection, which is always allowed. For example, Location: /anotherpage/onthisserver/internal_redirect.php would be allowed even if cross-domain request enforcement is enabled on the system.
Setting up cross-domain request enforcement
- On the Main tab, click The Allowed URLs screen opens. .
- In the Current edited policy list near the top of the screen, verify that the edited security policy is the one you want to work on.
- In the Allowed URLs List, click the name of the URL you want to modify. The Allowed URL Properties screen opens.
- From the Allowed URL Properties list, select Advanced.
- Select the HTML5 Cross-Domain Request Enforcement check box. The screen now includes an additional tab in the next area.
- On the HTML5 Cross-Domain Request Enforcement tab, select the Allow HTML5 Cross-Origin Requests check box. The tab now includes additional settings where you define which domains can access the response generated by a request to this URL, and how to overwrite CORS response headers returned by the web server.
In the Allowed Origins setting, add the origins that are
allowed to share data returned by this URL.
If you select Unmodified, the system leaves the
response header as set by the server. If you select Replace
with, specify the origin names:
- For Protocol, select the appropriate protocol for the allowed origin.
- For Origin Name, type the domain name or IP address that you want to allow to share your data with. Wildcards are allowed in the names. For example: *.f5.com will match b.f5.com; however it will not match a.b.f5.com.
- For Port, select the port that other web applications can use to request data from your web application, or use the * wildcard for all ports.
- If you want to allow sub-domains to receive data, select the Include Sub-Domains check box.
- Click Add to add the origins. The origins that can share data with the URL are included in the list.
For Allowed Methods, specify which methods other
applications may use when requesting this URL from another domain.
Move the methods to allow from the Available Methods to
the Allowed Methods list. Important: Any method you allow here must also be in the Allowed Methods list in the security policy ( ).
- For Allowed Headers, type the headers to allow other applications to use when requesting this URL from another domain. Allowed headers are request headers sent by clients. For example, to allow clients to send Ajax requests, type X-Requested-With, and to allow XML requests, type Content-Type.
- For Allow Credentials, specify whether requests from applications in another domains can include user credentials.
- For Maximum Age, specify the number of seconds that the results of a preflight request can be cached or use the default.
- Click Update.
- To put the security policy changes into effect immediately, click Apply Policy.
How cross-domain request enforcement works
The CORS-related headers that are included in a preflight request are:
|Origin||Determines requesting origin.|
|Access-Control-Request-Method||Indicates which methods are used in the actual request (other than simple methods).|
|Access-Control-Request-Headers||Indicates which headers are used in the actual request (other than simple headers).|
In response to the preflight request, the system uses these CORS response headers:
|Access-Control-Allow-Origin||List of origins the resource may be shared among (support wildcard).|
|Access-Control-Allow-Credentials||Indicates whether actual request may include user credentials (true/false).|
|Access-Control-Allow-Methods||Indicates which methods can be used during the actual request.|
|Access-Control-Allow-Headers||Indicates which request headers can be used during the actual request.|
|Access-Control-Max-Age||Indicates how long (in seconds) to cache the results of a preflight request in the browser.|
The browser then allows the foreign domain to send its original requests.
If you do not enable cross-domain request enforcement, the system removes all cross-origin request headers and CORS is not allowed for the URL.