Proxy cookies from and to Kibana
The fts-keystone plugin uses sessions to store information about authenticated user. As session id is stored in a cookie, this needs to be passed between browser and Kibana, so monasca-ui needs to proxy them. Without this, every action (request) in Kibana would need to be auhenticated by Keystone. This results in unnecessary load on Keystone and also impacts performance. Change-Id: Ie682443e87ee43fa30beee637b7bbf3873362f25
This commit is contained in:
parent
c07852b056
commit
e2d013fec3
@ -366,11 +366,14 @@ class KibanaProxyView(generic.View):
|
||||
|
||||
else:
|
||||
status = response.getcode()
|
||||
return http.StreamingHttpResponse(
|
||||
proxy_response = http.StreamingHttpResponse(
|
||||
proxy_stream_generator(response),
|
||||
status=status,
|
||||
content_type=response.headers['content-type']
|
||||
)
|
||||
if 'set-cookie' in response.headers:
|
||||
proxy_response['set-cookie'] = response.headers['set-cookie']
|
||||
return proxy_response
|
||||
|
||||
@csrf_exempt
|
||||
def dispatch(self, request, url):
|
||||
@ -390,7 +393,8 @@ class KibanaProxyView(generic.View):
|
||||
# passing kbn version explicitly for kibana >= 4.3.x
|
||||
headers = {
|
||||
'X-Auth-Token': request.user.token.id,
|
||||
'kbn-version': request.META.get('HTTP_KBN_VERSION', '')
|
||||
'kbn-version': request.META.get('HTTP_KBN_VERSION', ''),
|
||||
'Cookie': request.META.get('HTTP_COOKIE', '')
|
||||
}
|
||||
|
||||
return self.read(request.method, url, request.body, headers)
|
||||
|
Loading…
Reference in New Issue
Block a user