Skip to content

Commit 9ec0dc7

Browse files
committed
abandon the dynamic reflection of the client's Origin header
1 parent e4b01a3 commit 9ec0dc7

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

g11n-ws/vip-manager-i18n/src/main/java/com/vmware/vip/core/Interceptor/APICrossDomainInterceptor.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 VMware, Inc.
2+
* Copyright 2019-2026 VMware, Inc.
33
* SPDX-License-Identifier: EPL-2.0
44
*/
55
package com.vmware.vip.core.Interceptor;
@@ -30,8 +30,13 @@ public APICrossDomainInterceptor(Set<String> allowOrigin, String allowHeaders, S
3030
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
3131
throws Exception {
3232
String originHeader = request.getHeader("Origin");
33-
if (allowOrigin.contains("*") || allowOrigin.contains(originHeader)) {
34-
response.setHeader("Access-Control-Allow-Origin", originHeader == null ? "" : originHeader);
33+
if (allowOrigin.contains("*")) {
34+
response.setHeader("Access-Control-Allow-Origin", "*");
35+
response.setHeader("Access-Control-Allow-Methods", allowMethods);
36+
response.setHeader("Access-Control-Allow-Headers", allowHeaders);
37+
response.setHeader("Access-Control-Max-Age", maxAge);
38+
} else if (allowOrigin.contains(originHeader)) {
39+
response.setHeader("Access-Control-Allow-Origin", originHeader);
3540
response.setHeader("Access-Control-Allow-Methods", allowMethods);
3641
response.setHeader("Access-Control-Allow-Headers", allowHeaders);
3742
response.setHeader("Access-Control-Allow-Credentials", allowCredentials);

g11n-ws/vip-manager-i18n/src/main/resources/application-bundle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
#Copyright 2019-2022 VMware, Inc.
2+
#Copyright 2019-2026 VMware, Inc.
33
#SPDX-License-Identifier: EPL-2.0
44
##
55

@@ -71,7 +71,7 @@ vipservice.authority.ldap.searchbase=###
7171

7272
#cross-domain configuration
7373
vipservice.cross.domain.enable=true
74-
vipservice.cross.domain.allowCredentials=true
74+
vipservice.cross.domain.allowCredentials=false
7575
vipservice.cross.domain.alloworigin=*
7676
vipservice.cross.domain.allowmethods=GET, POST, PUT, DELETE, OPTIONS
7777
vipservice.cross.domain.allowheaders=csp-auth-token, Content-Type, x-xmp-ui, Authorization

g11n-ws/vip-manager-i18n/src/main/resources/application-gcs.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
#Copyright 2019-2022 VMware, Inc.
2+
#Copyright 2019-2026 VMware, Inc.
33
#SPDX-License-Identifier: EPL-2.0
44
##
55

@@ -69,7 +69,7 @@ vipservice.authority.ldap.searchbase=####
6969

7070
#cross-domain configuration
7171
vipservice.cross.domain.enable=true
72-
vipservice.cross.domain.allowCredentials=true
72+
vipservice.cross.domain.allowCredentials=false
7373
vipservice.cross.domain.alloworigin=*
7474
vipservice.cross.domain.allowmethods=GET, POST, PUT, DELETE, OPTIONS
7575
vipservice.cross.domain.allowheaders=csp-auth-token, Content-Type, x-xmp-ui, Authorization

g11n-ws/vip-manager-i18n/src/main/resources/application-s3.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
#Copyright 2019-2022 VMware, Inc.
2+
#Copyright 2019-2026 VMware, Inc.
33
#SPDX-License-Identifier: EPL-2.0
44
##
55

@@ -76,7 +76,7 @@ vipservice.authority.ldap.searchbase=####
7676

7777
#cross-domain configuration
7878
vipservice.cross.domain.enable=true
79-
vipservice.cross.domain.allowCredentials=true
79+
vipservice.cross.domain.allowCredentials=false
8080
vipservice.cross.domain.alloworigin=*
8181
vipservice.cross.domain.allowmethods=GET, POST, PUT, DELETE, OPTIONS
8282
vipservice.cross.domain.allowheaders=csp-auth-token, Content-Type, x-xmp-ui, Authorization

0 commit comments

Comments
 (0)