Managing Data Operating System
Also available as:
PDF
loading table of contents...

Enable Cross-Origin Support on YARN

You must enable Cross-Origin Resource Sharing (CORS) on YARN such 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.

You must first enable CORS at the cluster level and then on individual components such as YARN.

  1. In Ambari Web, browse to Services > HDFS > Configs, then expand Advanced core-site.
  2. Add the value org.apache.hadoop.security.HttpCrossOriginFilterInitializer to the existing set of values configured for the hadoop.http.filter.initializers property.
  3. Configure values for the following properties depending on your requirements:
    Property Description
    hadoop.http.cross-origin.allowed-headers Comma-separated list of headers allowed for cross-origin support.

    The default values are X-Requested-With, Content-Type, Accept, Origin, WWW-Authenticate, Accept-Encoding, and Transfer-Encoding.

    hadoop.http.cross-origin.allowed-origins 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 Comma-separated list of methods allowed for cross-origin support.

    The default values are GET, PUT, POST, OPTIONS, HEAD, and DELETE.

    hadoop.http.cross-origin.max-age Number of seconds until when a preflight request can be cached.

    The default value is 1800 seconds.

  4. Click Save.
  5. Add a description of the modified HDFS configuration and click Save.
  6. In Ambari Web, browse to Services > YARN > Configs, then expand Advanced yarn-site.
  7. Configure values for the following properties depending on your requirements:
    Property Description
    yarn.nodemanager.webapp.cross-origin.enabled Enable cross-origin support for the NodeManager.

    The default value is true.

    yarn.resourcemanager.webapp.cross-origin.enabled Enable cross-origin support for the ResourceManager.

    The default value is true.

    yarn.timeline-service.http-cross-origin.enabled Enable cross-origin support for the timeline service.

    The default value is true.

    Note
    Note
    The value of the hadoop.http.cross-origin.allowed-origins property in yarn-site.xml overrides the value of the same property in core-site.xml. You can configure the value of this property to allow access to specific domains; for example, regex:.*[.]hwx[.]site(:\d*)?.
  8. Click Save.
  9. Add a description of the modified YARN configuration and click Save.
  10. Restart the HDFS and YARN services.