diff --git a/scripts/helmcharts/openreplay/charts/assist/templates/ingress.yaml b/scripts/helmcharts/openreplay/charts/assist/templates/ingress.yaml index e553d8d70..3094af0a9 100644 --- a/scripts/helmcharts/openreplay/charts/assist/templates/ingress.yaml +++ b/scripts/helmcharts/openreplay/charts/assist/templates/ingress.yaml @@ -11,12 +11,24 @@ metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 nginx.ingress.kubernetes.io/configuration-snippet: | - # Extract sessionID from peerId using regex - if ($arg_peerId ~ ".*-(?[^-]+)-.*") { - set $session_id $extracted_sid; - } - add_header X-Debug-Session-ID $session_id; - add_header X-Debug-Session-Type "wss"; + #set $sticky_used "no"; + #if ($sessionid != "") { + # set $sticky_used "yes"; + #} + + #add_header X-Debug-Session-ID $sessionid; + #add_header X-Debug-Session-Type "wss"; + #add_header X-Sticky-Session-Used $sticky_used; + #add_header X-Upstream-Server $upstream_addr; + + proxy_hide_header access-control-allow-headers; + proxy_hide_header Access-Control-Allow-Origin; + add_header 'Access-Control-Allow-Origin' $http_origin always; + add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'sessionid, Content-Type, Authorization' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + nginx.ingress.kubernetes.io/upstream-hash-by: $session_id {{- with .Values.ingress.annotations }} diff --git a/scripts/helmcharts/openreplay/values.yaml b/scripts/helmcharts/openreplay/values.yaml index 9d90dfef2..8be97a2dc 100644 --- a/scripts/helmcharts/openreplay/values.yaml +++ b/scripts/helmcharts/openreplay/values.yaml @@ -17,6 +17,13 @@ redis: &redis ingress-nginx: enabled: true controller: + config: + http-snippet: |- + # Extract sessionid from peerId, it'll be used for sticky session. + map $arg_peerId $sessionid { + default ""; + "~.*-(\d+)(?:-.*|$)" $1; + } admissionWebhooks: patch: podAnnotations: