private void setCorsHeadersForSwaggerUi(ApiRequest request, ApiResponse response) {
        if (hasOriginHeader(request) && originIsAllowed(request)) {
            // check if response already contains CORS Headers - we don't overwrite existing CORS Headers from API or CORS Policy
            if (hasNoCorsAccessControlAllowOrigin(response)) {
                // Check if the request from the UI is a preflight request
                if (isPreflightRequest(request)) {
                    response.getHeaders().clear();
                    // we allow all requested methods and headers
                    response.getHeaders().add("Access-Control-Allow-Origin", request.getHeaders().get("Origin"));
                    response.getHeaders().add("Access-Control-Allow-Credentials", "true");
                    response.getHeaders().add("Access-Control-Max-Age", "1800");
                    response.getHeaders().add("Access-Control-Allow-Methods", request.getHeaders().get("Access-Control-Request-Method"));
                    response.getHeaders().add("Access-Control-Allow-Headers", request.getHeaders().get("Access-Control-Request-Headers"));
                    response.setCode(200);
                    response.setMessage("OK");
                } else {
                    response.getHeaders().add("Access-Control-Allow-Origin", request.getHeaders().get("Origin"));
                    response.getHeaders().add("Access-Control-Allow-Credentials", "true");
                }
            }
        }
    }
Set correct CORS headers in the response for SwaggerUis
@param request the ApiRequest
@param response the ApiResponse
@llink  @see io.apiman.common.servlet.ApimanCorsFilter
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/http/HttpPolicyAdapter.java