Configure Cross-Origin Support for YARN UIs and REST APIs
Cross-Origin Resource Sharing (CORS) is enabled by default on YARN so that the corresponding services accept cross-origin requests from only selected domains. Enabling CORS also helps the YARN UI fetch data endpoints from the browser.
CORS is enabled at cluster level and then on individual components such as YARN. If you want to set other values than the default ones, use safety valves in Cloudera Manager to configure the CORS configuration properties.
- In the Cloudera Manager, select the YARN service.
- Click the Configuration tab.
- Search for core-site.xml.
- Find YARN Service Advanced Configuration Snippet (Safety Valve) for core-site.xml.
-
Click on the plus icon to add and configure the following properties :
Property Default value Description hadoop.http.cross-origin.allowed-origins
regex:.*[.]subdomain[.]example[.]com(;\d+)?.*
Comma-separated list of origins allowed for cross-origin support.
The default value is *. Mention only specific origins so that the services do not accept all the cross-origin requests.
hadoop.http.cross-origin.allowed-methods
GET, PUT, POST, OPTIONS, HEAD, DELETE
Comma-separated list of methods allowed for cross-origin support.
hadoop.http.cross-origin.allowed-headers
X-Requested-With, Content-Type, Accept, Origin, WWW-Authenticate, Accept-Encoding, Transfer-Encoding
Comma-separated list of headers allowed for cross-origin support.
hadoop.http.cross-origin.max-age
180
Number of seconds until when a preflight request can be cached.
- Click Save Changes.
- In the Cloudera Manager, select the YARN service.
- Click the Configuration tab.
- Search for yarn-site.xml.
- Find the YARN Service Advanced Configuration Snippet (Safety Valve) for yarn-site.xml.
-
Click on the plus icon to add and configure the cross-origin.enabled
properties:
Property Default value Description yarn.nodemanager.webapp.cross-origin.enabled
true
Enable cross-origin support for the NodeManager.
yarn.resourcemanager.webapp.cross-origin.enabled
true
Enable cross-origin support for the ResourceManager.
yarn.timeline-service.http-cross-origin.enabled
true
Enable cross-origin support for the timeline service.
- Click Save Changes.
- Restart the HDFS and YARN services.