Search code examples
angularjsxmlhttprequestkubernetes

Enabling CORS in Kubernetes API server with HTTPS


I'm trying to work with Kubernetes API server from Angular JS front-end app. The API server uses https endpoint. The front-end app is deployed to the other server.

Despite the --cors-allowed-origins=.* (or --cors-allowed-origins=["http://*"]) param for kube-apiserver I can't access API because when I try to make GET XHR request, pre-flight OPTIONS request failed with 401 response without CORS headers.

However, when I switch from https to http, everything works fine.

Looks like I'm facing this issue, which is already fixed and merged in the version of Kubernetes I'm using.

Versions are Kubernetes 1.2.4, Angular JS 1.5.4 and Chrome 51.

Could you tell me why it happens and how to fix this? I need a working solution for https.


Solution

  • The issue you linked to was fixed, but a regression in CORS handling was introduced by kubernetes/kubernetes#18113 and has yet to be fixed (see kubernetes/kubernetes#24086). It is currently marked as a known issue for the imminent 1.3 release, which means that it is an outstanding bug.