Allowing JavaScript-based access to the API server from additional hosts

    If you need to access the API server or OAuth server from a JavaScript application using a different hostname, you can configure additional hostnames to allow.

    Prerequisites

    • Access to the cluster as a user with the role.

    Procedure

    1. Add the additionalCORSAllowedOrigins field under the spec section and specify one or more additional hostnames:

      1. apiVersion: config.openshift.io/v1
      2. kind: APIServer
      3. metadata:
      4. creationTimestamp: "2019-07-11T17:35:37Z"
      5. generation: 1
      6. name: cluster
      7. resourceVersion: "907"
      8. selfLink: /apis/config.openshift.io/v1/apiservers/cluster
      9. uid: 4b45a8dd-a402-11e9-91ec-0219944e0696
      10. - (?i)//my\.subdomain\.domain\.com(:|\z) (1)

      This example uses the following syntax:

      • The (?i) makes it case-insensitive.

      • The . escapes dots in the domain name.

      • The (:|\z) matches the end of the domain name or a port separator (:).

    2. Save the file to apply the changes.