From dda0a704d3d227322d99c107134bed9771fe77bd Mon Sep 17 00:00:00 2001 From: CrowleyRajapakse Date: Mon, 28 Oct 2024 13:19:18 +0530 Subject: [PATCH] adding CORS template --- .../gateway-components/log-conf.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml index 8ab3f1821..5e9457f36 100644 --- a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml @@ -157,6 +157,24 @@ data: {{end}} {{end}} + {{ if and .Values.wso2.apk.dp.gatewayRuntime.deployment .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors }} + [enforcer.cors] + enabled = {{ .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.enabled | default false }} + accessControlAllowOrigins = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.accessControlAllowOrigins }}] + accessControlAllowMethods = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.accessControlAllowMethods }}] + accessControlAllowHeaders = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.accessControlAllowHeaders }}] + accessControlAllowCredentials = {{ .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.accessControlAllowCredentials | default false }} + accessControlExposeHeaders = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.cors.accessControlExposeHeaders }}] + {{- else }} + [enforcer.cors] + enabled = true + accessControlAllowOrigins = ["*"] + accessControlAllowMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"] + accessControlAllowHeaders = ["authorization", "Access-Control-Allow-Origin", "Content-Type", "Internal-key", "ApiKey"] + accessControlAllowCredentials = false + accessControlExposeHeaders = ["*"] + {{end}} + [enforcer.jwtGenerator] publicCertificatePath = "/home/wso2/security/truststore/mg.pem" privateKeyPath = "/home/wso2/security/keystore/mg.key"