Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preflight requests handled by @Filters blocked by CorsFilter #11375

Open
ThomasIommi opened this issue Nov 23, 2024 · 0 comments
Open

Preflight requests handled by @Filters blocked by CorsFilter #11375

ThomasIommi opened this issue Nov 23, 2024 · 0 comments

Comments

@ThomasIommi
Copy link

ThomasIommi commented Nov 23, 2024

Hello!

As mentioned in issue #7934, it seems that the router might not recognize paths defined using patterns like those used by @Filters.
I'm afraid that checking for known paths reintroduce the same issue, causing all requests to a proxy filter to be blocked by the CORS filter with a 403 Forbidden error.

This situation seems to prevent us from implementing solutions suggested in the official documentation, such as the one found here: https://docs.micronaut.io/latest/guide/#proxyClient

Here's a snippet of the code in question:

@Nullable
private boolean validatePreflightRequest(@NonNull HttpRequest<?> request,
                                         @NonNull CorsOriginConfiguration config) {
    ...
    List<HttpMethod> availableHttpMethods = router.findAny(request).stream().map(UriRouteMatch::getHttpMethod).toList();
    if (availableHttpMethods.stream().noneMatch(method -> method.equals(methodToMatch))) {
        return false;
    }    
    ...
    return true;
}

Originally posted by @ThomasIommi in #11097 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant