Skip to content

Commit

Permalink
Fixing the issue quarkusio#33922 about Access-Control-Expose-Headers
Browse files Browse the repository at this point in the history
Signed-off-by: Rhuan Rocha <[email protected]>
  • Loading branch information
rhuan080 committed Jun 9, 2023
1 parent adcaefc commit 169b8db
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ public void handle(RoutingContext event) {
if (allowedMethods != null) {
response.headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, allowedMethods);
}

//always set expose headers if present
if (exposedHeaders != null) {
response.headers().add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, exposedHeaders);
}

if (!isConfiguredWithWildcard(corsConfig.exposedHeaders)) {
response.headers().set(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, this.exposedHeaders);
}

//we check that the actual request matches the allowed methods and headers
if (!isMethodAllowed(request.method())) {
LOG.debug("Method is not allowed");
Expand Down Expand Up @@ -211,15 +221,6 @@ private void handlePreflightRequest(RoutingContext event, String requestedHeader
processPreFlightRequestedHeaders(response, requestedHeaders);
}

//always set expose headers if present
if (exposedHeaders != null) {
response.headers().add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, exposedHeaders);
}

if (!isConfiguredWithWildcard(corsConfig.exposedHeaders)) {
response.headers().set(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, this.exposedHeaders);
}

}

static boolean isSameOrigin(HttpServerRequest request, String origin) {
Expand Down

0 comments on commit 169b8db

Please sign in to comment.